Пример #1
0
 /**
  * Forward to the next revision
  */
 public function next()
 {
     $this->nextRevision = $this->nextRevision->increment();
     if ($this->nextRevision->getRevision() == $this->latestRevision->getRevision()) {
         $this->nextRevision = $this->nextRevision->setDraft($this->latestRevision->isDraft());
     }
 }
Пример #2
0
 /**
  * Publish the current object revision
  *
  * @return ObjectInterface Object
  */
 public function publish()
 {
     // If this is an unpublished draft
     if ($this->isDraft() & !$this->hasBeenPublished()) {
         $this->setPublishedState();
         $this->latestRevision = $this->latestRevision->setDraft(false);
         $this->updateLocator();
     }
     return $this;
 }
Пример #3
0
 /**
  * Indicate that the object got published
  *
  * @return SystemProperties System properties
  * @throws RuntimeException If the object is already published
  */
 public function publish()
 {
     // If the object is already published
     if ($this->published instanceof \DateTimeInterface) {
         throw new RuntimeException('Cannot republish object previously published at ' . $this->published->format('c'), RuntimeException::CANNOT_REPUBLISH_OBJECT);
     }
     $systemProperties = clone $this;
     $systemProperties->published = new \DateTimeImmutable();
     $systemProperties->revision = $this->revision->setDraft(false);
     return $systemProperties;
 }