persist() public method

public persist ( $object )
Beispiel #1
0
 /**
  * Updates a group.
  *
  * @param GroupInterface $group
  */
 public function updateGroup(GroupInterface $group, $andFlush = true)
 {
     $this->dm->persist($group);
     if ($andFlush) {
         $this->dm->flush();
     }
 }
 /**
  * Updates a user.
  *
  * @extra:SecureParam(name="user", permissions="EDIT")
  * @param UserInterface $user
  * @param Boolean $andFlush Whether to flush the changes (default true)
  */
 public function updateUser(UserInterface $user, $andFlush = true)
 {
     $this->updateCanonicalFields($user);
     $this->updatePassword($user);
     $this->dm->persist($user);
     if ($andFlush) {
         $this->dm->flush();
     }
 }
 public function testLoadingMappedsuperclass()
 {
     $document = new ExtendingClass();
     $document->topic = 'Superclass test';
     $document->headline = 'test test test';
     $this->dm->persist($document);
     $this->dm->flush();
     $id = $document->id;
     $this->dm->clear();
     $doc = $this->dm->find('Doctrine\\Tests\\Models\\Mapping\\ExtendingClass', $id);
     $this->assertInstanceOf('\\Doctrine\\Tests\\Models\\Mapping\\ExtendingClass', $doc);
     $this->assertEquals('test test test', $doc->headline);
     $this->assertEquals('Superclass test', $doc->topic);
 }
 /**
  * @param object $object
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  * @return void
  */
 public function add($object)
 {
     if (!is_object($object) || !$object instanceof $this->entityClassName) {
         $type = is_object($object) ? get_class($object) : gettype($object);
         throw new \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
     }
     $this->documentManager->persist($object);
 }