|
@@ 252-263 (lines=12) @@
|
| 249 |
|
* |
| 250 |
|
* @throws ORM\Mapping\MappingException |
| 251 |
|
*/ |
| 252 |
|
public function preUpdate($entity, ORM\Event\LifecycleEventArgs $eventArgs) : void |
| 253 |
|
{ |
| 254 |
|
$em = $eventArgs->getEntityManager(); |
| 255 |
|
$uow = $em->getUnitOfWork(); |
| 256 |
|
$classMetadata = $em->getClassMetadata(get_class($entity)); |
| 257 |
|
|
| 258 |
|
if ($config = $this->driver->getObjectConfigurations($em, $classMetadata->getName())) { |
| 259 |
|
if (isset($config['update'])) { |
| 260 |
|
$this->updateFields($config['update'], $uow, $entity, $classMetadata); |
| 261 |
|
} |
| 262 |
|
} |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
/** |
| 266 |
|
* @param mixed $entity |
|
@@ 273-284 (lines=12) @@
|
| 270 |
|
* |
| 271 |
|
* @throws ORM\Mapping\MappingException |
| 272 |
|
*/ |
| 273 |
|
public function preRemove($entity, ORM\Event\LifecycleEventArgs $eventArgs) : void |
| 274 |
|
{ |
| 275 |
|
$em = $eventArgs->getEntityManager(); |
| 276 |
|
$uow = $em->getUnitOfWork(); |
| 277 |
|
$classMetadata = $em->getClassMetadata(get_class($entity)); |
| 278 |
|
|
| 279 |
|
if ($config = $this->driver->getObjectConfigurations($em, $classMetadata->getName())) { |
| 280 |
|
if (isset($config['delete'])) { |
| 281 |
|
$this->updateFields($config['delete'], $uow, $entity, $classMetadata); |
| 282 |
|
} |
| 283 |
|
} |
| 284 |
|
} |
| 285 |
|
|
| 286 |
|
/** |
| 287 |
|
* Set a custom representation of current user |