"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Neos.Flow/Classes/Persistence/Doctrine/ObjectValidationAndDeDuplicationListener.php" between
flow-development-collection-7.2.0.tar.gz and flow-development-collection-7.2.1.tar.gz

About: TYPO3 Flow is a web application platform enabling developers creating fast, reliable and complex web solutions ("the next level of PHP programming"; old name "FLOW3").

ObjectValidationAndDeDuplicationListener.php  (flow-development-collection-7.2.0):ObjectValidationAndDeDuplicationListener.php  (flow-development-collection-7.2.1)
skipping to change at line 21 skipping to change at line 21
* source code. * source code.
*/ */
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Event\OnFlushEventArgs;
use Neos\Flow\Annotations as Flow; use Neos\Flow\Annotations as Flow;
use Neos\Flow\Persistence\Exception\ObjectValidationFailedException; use Neos\Flow\Persistence\Exception\ObjectValidationFailedException;
use Neos\Flow\Reflection\ClassSchema; use Neos\Flow\Reflection\ClassSchema;
use Neos\Flow\Reflection\ReflectionService; use Neos\Flow\Reflection\ReflectionService;
use Neos\Flow\Validation\ValidatorResolver; use Neos\Flow\Validation\ValidatorResolver;
use Neos\Utility\ObjectAccess;
use Neos\Utility\TypeHandling; use Neos\Utility\TypeHandling;
/** /**
* An onFlush listener for Flow's Doctrine PersistenceManager. * An onFlush listener for Flow's Doctrine PersistenceManager.
* *
* Used to de-duplicate value objects and validate new and updated objects durin g flush. * Used to de-duplicate value objects and validate new and updated objects durin g flush.
* *
* @Flow\Scope("singleton") * @Flow\Scope("singleton")
* @api * @api
*/ */
skipping to change at line 100 skipping to change at line 99
$entityInsertions = $unitOfWork->getScheduledEntityInsertions(); $entityInsertions = $unitOfWork->getScheduledEntityInsertions();
$knownValueObjects = []; $knownValueObjects = [];
foreach ($entityInsertions as $entity) { foreach ($entityInsertions as $entity) {
$className = TypeHandling::getTypeForValue($entity); $className = TypeHandling::getTypeForValue($entity);
$classSchema = $this->reflectionService->getClassSchema($className); $classSchema = $this->reflectionService->getClassSchema($className);
if ($classSchema !== null && $classSchema->getModelType() === ClassS chema::MODELTYPE_VALUEOBJECT) { if ($classSchema !== null && $classSchema->getModelType() === ClassS chema::MODELTYPE_VALUEOBJECT) {
$identifier = $this->persistenceManager->getIdentifierByObject($ entity); $identifier = $this->persistenceManager->getIdentifierByObject($ entity);
if (isset($knownValueObjects[$className][$identifier]) || $unitO fWork->getEntityPersister($className)->exists($entity)) { if (isset($knownValueObjects[$className][$identifier]) || $unitO fWork->getEntityPersister($className)->exists($entity)) {
unset($entityInsertions[spl_object_hash($entity)]); $unitOfWork->scheduleForDelete($entity);
continue; continue;
} }
$knownValueObjects[$className][$identifier] = true; $knownValueObjects[$className][$identifier] = true;
} }
} }
ObjectAccess::setProperty($unitOfWork, 'entityInsertions', $entityInsert
ions, true);
} }
/** /**
* Validates the given object and throws an exception if validation fails. * Validates the given object and throws an exception if validation fails.
* *
* @param object $object * @param object $object
* @param \SplObjectStorage $validatedInstancesContainer * @param \SplObjectStorage $validatedInstancesContainer
* @return void * @return void
* @throws ObjectValidationFailedException * @throws ObjectValidationFailedException
*/ */
 End of changes. 3 change blocks. 
5 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)