Ejemplo n.º 1
0
 /**
  * Set the legacy ContentType object on the Entity.
  *
  * @param Entity\Entity $entity
  */
 public function setupContenttype(Entity\Entity $entity)
 {
     $contentType = $entity->getContenttype();
     if (is_string($contentType)) {
         $entity->contenttype = new ContentType($contentType, $this->app['storage']->getContenttype($contentType));
     }
 }
Ejemplo n.º 2
0
 /**
  * Check whether the status is allowed.
  *
  * We act as if a status *transition* were requested and fallback to the old
  * status otherwise.
  *
  * @param Entity\Entity $content
  * @param string        $contentTypeSlug
  * @param integer       $id
  * @param string        $oldStatus
  */
 private function setTransitionStatus(Entity\Entity $content, $contentTypeSlug, $id, $oldStatus)
 {
     $canTransition = $this->app['users']->isContentStatusTransitionAllowed($oldStatus, $content->getStatus(), $contentTypeSlug, $id);
     if (!$canTransition) {
         $content->setStatus($oldStatus);
     }
 }