|
@@ 245-256 (lines=12) @@
|
| 242 |
|
* @param mixed $entity |
| 243 |
|
* @param ORM\Event\LifecycleEventArgs $eventArgs |
| 244 |
|
*/ |
| 245 |
|
public function preUpdate($entity, Doctrine\ORM\Event\LifecycleEventArgs $eventArgs) |
| 246 |
|
{ |
| 247 |
|
$em = $eventArgs->getEntityManager(); |
| 248 |
|
$uow = $em->getUnitOfWork(); |
| 249 |
|
$classMetadata = $em->getClassMetadata(get_class($entity)); |
| 250 |
|
|
| 251 |
|
if ($config = $this->driver->getObjectConfigurations($classMetadata->getName())) { |
| 252 |
|
if (isset($config['update'])) { |
| 253 |
|
$this->updateFields($config['update'], $uow, $entity, $classMetadata); |
| 254 |
|
} |
| 255 |
|
} |
| 256 |
|
} |
| 257 |
|
|
| 258 |
|
/** |
| 259 |
|
* @param mixed $entity |
|
@@ 262-273 (lines=12) @@
|
| 259 |
|
* @param mixed $entity |
| 260 |
|
* @param ORM\Event\LifecycleEventArgs $eventArgs |
| 261 |
|
*/ |
| 262 |
|
public function preRemove($entity, Doctrine\ORM\Event\LifecycleEventArgs $eventArgs) |
| 263 |
|
{ |
| 264 |
|
$em = $eventArgs->getEntityManager(); |
| 265 |
|
$uow = $em->getUnitOfWork(); |
| 266 |
|
$classMetadata = $em->getClassMetadata(get_class($entity)); |
| 267 |
|
|
| 268 |
|
if ($config = $this->driver->getObjectConfigurations($classMetadata->getName())) { |
| 269 |
|
if (isset($config['delete'])) { |
| 270 |
|
$this->updateFields($config['delete'], $uow, $entity, $classMetadata); |
| 271 |
|
} |
| 272 |
|
} |
| 273 |
|
} |
| 274 |
|
|
| 275 |
|
/** |
| 276 |
|
* Set a custom representation of current user |