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