Esempio n. 1
0
 /**
  * Persist the current object revision
  *
  * @return ObjectInterface Object
  */
 public function persist()
 {
     // If this is not the latest revision
     if ($this->getRevision()->getRevision() !== $this->latestRevision->getRevision()) {
         throw new RuntimeException(sprintf('Cannot persist revision %s/%s', $this->getRevision()->getRevision(), $this->latestRevision->getRevision()), RuntimeException::CANNOT_PERSIST_EARLIER_REVISION);
     }
     // Update the object repository
     $this->locator->getRepository()->updateObject($this);
     // Reset to a clean state
     $this->resetState();
     $this->latestRevision = $this->getRevision();
     $this->updateLocator();
     // Post persistence hook
     $this->postPersist();
     return $this;
 }
Esempio n. 2
0
 /**
  * Test whether an object resource exists
  *
  * @param RepositoryLocatorInterface $locator
  * @return boolean Object resource exists
  */
 public function objectResourceExists(RepositoryLocatorInterface $locator)
 {
     return $locator->getRepository()->getAdapterStrategy()->hasResource($locator->withExtension(getenv('OBJECT_RESOURCE_EXTENSION')));
 }