Example #1
0
 /**
  * Get an instance of the action class to be used
  * @throws DrestException
  * @return AbstractAction $action
  */
 protected function getActionInstance()
 {
     if (!isset($this->service_action)) {
         if ($this->service_action_registry->hasServiceAction($this->matched_route)) {
             $this->service_action = $this->service_action_registry->getServiceAction($this->matched_route);
             $this->service_action->setService($this);
         } else {
             $this->service_action = $this->getDefaultAction();
         }
         if (!$this->service_action instanceof AbstractAction) {
             throw DrestException::actionClassNotAnInstanceOfActionAbstract(get_class($this->service_action));
         }
     }
     return $this->service_action;
 }
Example #2
0
 /**
  * Get an alias for this entity - used for DQL / QueryBuilder
  * @param  string $fieldName - The field the relation is on. Typical to root when using top level.
  * @return string alias unique string representing this entity
  */
 public function getEntityAlias($fieldName = 'rt')
 {
     return AbstractAction::getAlias($this->getClassName(), $fieldName);
 }