protected function getModelBySubject(Request $request, $subject)
 {
     $model = $this->rdfMapper->getBySubject($subject);
     if (empty($model)) {
         throw new NotFoundHttpException($subject . ' not found');
     }
     return $model;
 }
 protected function getModelBySubject(Request $request, $subject)
 {
     $model = $this->rdfMapper->getBySubject($subject);
     if (empty($model)) {
         throw new NotFoundHttpException($subject . ' not found');
     }
     if ($this->forceRequestLocale && $model instanceof TranslatableInterface) {
         $model->setLocale($request->getLocale());
     }
     return $model;
 }
Exemple #3
0
 /**
  * returns the rdf configs schema name we have to proceed on
  *
  * @param array $data
  * @return string
  */
 private function _get_rdf_schema_name(array $data = null)
 {
     if (!empty($data)) {
         $object = $this->_mapper->getBySubject(trim($data['@subject'], '<>'));
     } else {
         if (!empty($_GET['subject'])) {
             $object = $this->_mapper->getBySubject(trim($_GET['subject'], '<>'));
         }
     }
     return get_class($object);
 }
Exemple #4
0
 /**
  * Get all workflows available for this subject
  *
  * @param string $subject the RDFa identifier of the subject to get workflows for
  *
  * @return array of WorkflowInterface
  */
 public function getWorkflows($subject)
 {
     $response = array();
     $object = $this->_mapper->getBySubject(trim($subject, '<>'));
     foreach ($this->_workflows as $identifier => $workflow) {
         /** @var $workflow WorkflowInterface */
         $toolbar_config = $workflow->getToolbarConfig($object);
         if (null !== $toolbar_config) {
             $response[] = $toolbar_config;
         }
     }
     return $response;
 }