Neos\Flow\Persistence\Repository::add PHP Méthode

add() public méthode

Adds an object to this repository.
public add ( object $object ) : void
$object object The object to add
Résultat void
    public function add($object)
    {
        if (!is_object($object) || !$object instanceof $this->entityClassName) {
            $type = is_object($object) ? get_class($object) : gettype($object);
            throw new IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
        }
        $this->persistenceManager->add($object);
    }

Usage Example

 /**
  * @param object $object
  * @throws IllegalObjectTypeException
  */
 public function add($object)
 {
     $this->persistenceManager->whitelistObject($object);
     if ($this->removedResources->contains($object)) {
         $this->removedResources->detach($object);
     }
     if (!$this->addedResources->contains($object)) {
         $this->addedResources->attach($object);
         parent::add($object);
     }
 }
All Usage Examples Of Neos\Flow\Persistence\Repository::add