Neos\Flow\Mvc\Routing\ObjectPathMappingRepository::persistEntities PHP Méthode

persistEntities() public méthode

Persists all entities managed by the repository and all cascading dependencies
public persistEntities ( ) : void
Résultat void
    public function persistEntities()
    {
        foreach ($this->entityManager->getUnitOfWork()->getIdentityMap() as $className => $entities) {
            if ($className === $this->entityClassName) {
                foreach ($entities as $entityToPersist) {
                    $this->entityManager->flush($entityToPersist);
                }
                return;
            }
        }
    }

Usage Example

 /**
  * Creates a new ObjectPathMapping and stores it in the repository
  *
  * @param string $pathSegment
  * @param string|integer $identifier
  * @return void
  */
 protected function storeObjectPathMapping($pathSegment, $identifier)
 {
     $objectPathMapping = new ObjectPathMapping();
     $objectPathMapping->setObjectType($this->objectType);
     $objectPathMapping->setUriPattern($this->getUriPattern());
     $objectPathMapping->setPathSegment($pathSegment);
     $objectPathMapping->setIdentifier($identifier);
     $this->objectPathMappingRepository->add($objectPathMapping);
     $this->objectPathMappingRepository->persistEntities();
 }