Beispiel #1
0
 /**
  * INTERNAL:
  * Computes the changeset of an individual document, independently of the
  * computeChangeSets() routine that is used at the beginning of a UnitOfWork#commit().
  *
  * The passed document must be a managed document. If the document already has a change set
  * because this method is invoked during a commit cycle then the change sets are added.
  * whereby changes detected in this method prevail.
  *
  * @ignore
  * @param ClassMetadata $class The class descriptor of the document.
  * @param object $document The document for which to (re)calculate the change set.
  * @throws \InvalidArgumentException If the passed document is not MANAGED.
  */
 public function recomputeSingleDocumentChangeSet(ClassMetadata $class, $document)
 {
     // Ignore uninitialized proxy objects
     if ($document instanceof Proxy && !$document->__isInitialized__) {
         return;
     }
     $oid = spl_object_hash($document);
     if (!isset($this->documentStates[$oid]) || $this->documentStates[$oid] != self::STATE_MANAGED) {
         throw new \InvalidArgumentException('Document must be managed.');
     }
     if (!$class->isInheritanceTypeNone()) {
         $class = $this->dm->getClassMetadata(get_class($document));
     }
     $this->computeOrRecomputeChangeSet($class, $document, true);
 }