Exemplo n.º 1
0
 protected function getEntityAdapterForAction(Action $action, $context = MetaAdapter::CONTEXT_DEFAULT)
 {
     $entityMeta = $action->getEntityMeta($this->entityMetaProvider);
     if ($action->isSpecific()) {
         return $entityMeta->getAdapter($action->getEntity(), $context);
     }
     if ($action->isGeneral()) {
         return $entityMeta->getAdapter($context);
     }
 }
Exemplo n.º 2
0
 /**
  * @return string
  */
 protected function generateUrl(Action $action)
 {
     $entityMeta = $action->getEntityMeta($this->entityMetaProvider);
     $url = '/entities';
     if ($action->isSpecific()) {
         $url .= '/' . $entityMeta->getEntityName();
         $url .= '/' . $action->getEntity()->getIdentifier();
     } else {
         $url .= '/' . $entityMeta->getEntityNamePlural();
     }
     if ($action->hasSubResource()) {
         $url .= '/' . $action->getSubResource();
     }
     return $url;
 }