Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkingmedia/5a288e32b95dc78b54b26c9f170e7e07 to your computer and use it in GitHub Desktop.
Save thinkingmedia/5a288e32b95dc78b54b26c9f170e7e07 to your computer and use it in GitHub Desktop.
class RestCreateComponent extends RestComponent
{
public $components = ['RestError'];
public function initialize(array $config)
{
parent::initialize($config);
$con = $this->getController();
$this->eventManager($con->eventManager());
}
public function create() {
return $this->RestError->couldNotSave();
}
}
class RestErrorComponent extends Component
{
public function initialize(array $config)
{
// this is never called
parent::initialize($config);
$con = $this->getController();
$this->eventManager($con->eventManager());
}
public function couldNotSave() {
return "stuff";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment