Neos\Flow\Persistence\PersistenceManagerInterface::isNewObject PHP Method

isNewObject() public method

Checks if the given object has ever been persisted.
public isNewObject ( object $object ) : boolean
$object object The object to check
return boolean TRUE if the object is new, FALSE if the object exists in the repository
    public function isNewObject($object);

Usage Example

 /**
  * Renders a hidden form field containing the technical identity of the given object.
  *
  * @param object $object Object to create the identity field for
  * @param string $name Name
  * @return string A hidden field containing the Identity (UUID in Flow) of the given object or NULL if the object is unknown to the persistence framework
  * @see \Neos\Flow\Mvc\Controller\Argument::setValue()
  */
 protected function renderHiddenIdentityField($object, $name)
 {
     if (!is_object($object) || $this->persistenceManager->isNewObject($object)) {
         return '';
     }
     $identifier = $this->persistenceManager->getIdentifierByObject($object);
     if ($identifier === null) {
         return chr(10) . '<!-- Object of type ' . get_class($object) . ' is without identity -->' . chr(10);
     }
     $name = $this->prefixFieldName($name) . '[__identity]';
     $this->registerFieldNameForFormTokenGeneration($name);
     return chr(10) . '<input type="hidden" name="' . $name . '" value="' . $identifier . '" />' . chr(10);
 }
All Usage Examples Of Neos\Flow\Persistence\PersistenceManagerInterface::isNewObject