persist() public method

Persists an entity as part of the current unit of work.
public persist ( object $entity )
$entity object The entity to persist.
Example #1
0
 /**
  * Tells the EntityManager to make an instance managed and persistent.
  *
  * The entity will be entered into the database at or before transaction
  * commit or as a result of the flush operation.
  *
  * NOTE: The persist operation always considers entities that are not yet known to
  * this EntityManager as NEW. Do not pass detached entities to the persist operation.
  *
  * @param object $object The instance to make managed and persistent.
  */
 public function persist($entity)
 {
     if (!is_object($entity)) {
         throw new \InvalidArgumentException(gettype($entity));
     }
     $this->errorIfClosed();
     $this->unitOfWork->persist($entity);
 }
 /**
  * Tells the EntityManager to make an instance managed and persistent.
  *
  * The entity will be entered into the database at or before transaction
  * commit or as a result of the flush operation.
  *
  * NOTE: The persist operation always considers entities that are not yet known to
  * this EntityManager as NEW. Do not pass detached entities to the persist operation.
  *
  * @param object $object The instance to make managed and persistent.
  */
 public function persist($entity)
 {
     if (!is_object($entity)) {
         throw ORMInvalidArgumentException::invalidObject('EntityManager#persist()', $entity);
     }
     $this->errorIfClosed();
     $this->unitOfWork->persist($entity);
 }
 /**
  * Compute changeset
  * @param object $entity
  */
 protected function computeChangeset($entity)
 {
     $this->uow->persist($entity);
     $this->uow->computeChangeSet($this->getMetadata($entity), $entity);
 }