protected function getResourceBase()
{
if (array_key_exists('through', $this->options)) {
if ($this->getParentResource()) {
if (array_key_exists('singleton', $this->options)) {
return $this->getResourceClass();
} elseif (array_key_exists('throughAssociation', $this->options)) {
$associationName = $this->options['throughAssociation'];
return get_classname($this->getParentResource()->{$associationName}()->getModel());
} else {
$associationName = str_plural(camel_case($this->getName()));
return get_classname($this->getParentResource()->{$associationName}()->getModel());
}
} elseif (array_key_exists('shallow', $this->options)) {
return $this->getResourceClass();
} else {
// Maybe this should be a record not found error instead?
throw new Exceptions\AccessDenied(null, $this->getAuthorizationAction(), $this->getResourceClass());
}
} else {
return $this->getResourceClass();
}
}