示例#1
0
 /**
  * Registers the given Document
  *
  * This is a high level shorthand for:
  * Object exists?
  *    Yes -> update
  *    No -> add
  *
  * @param Document $object
  * @return Document Returns the registered Document
  */
 public function registerObject($object)
 {
     $foundObject = $this->findByGuid($object->getGuid());
     // If the object appears as new but has a matching object merge those
     if ($this->persistenceManager->isNewObject($object) && $foundObject) {
         $object = $this->mergeDocuments($foundObject, $object);
     }
     //if ($this->persistenceManager->isNewObject($object) || $this->useRawQueryResults) {
     if ($object->_isNew() || $this->useRawQueryResults) {
         $this->add($object);
     } else {
         $this->update($object);
     }
     return $object;
 }
示例#2
0
 /**
  * @test
  */
 public function getInitialGuidTest()
 {
     $result = $this->fixture->getGuid();
     $this->assertNull($result);
 }