Doctrine\ODM\MongoDB\DocumentManager::persist PHP Method

persist() public method

The document 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 documents that are not yet known to this DocumentManager as NEW. Do not pass detached documents to the persist operation.
public persist ( object $document )
$document object The instance to make managed and persistent.
    public function persist($document)
    {
        if (!is_object($document)) {
            throw new \InvalidArgumentException(gettype($document));
        }
        $this->errorIfClosed();
        $this->unitOfWork->persist($document);
    }

Usage Example

Example #1
0
 public function updateAttendee(AttendeeInterface $attendee)
 {
     $attendee->setUpdatedAt(new \DateTime());
     $this->em->persist($attendee);
     $this->em->flush();
     return true;
 }
All Usage Examples Of Doctrine\ODM\MongoDB\DocumentManager::persist