/** * 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)); } }
/** * 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); } }