Skip to content

Instantly share code, notes, and snippets.

@Theaxiom
Created April 11, 2017 16:15
Show Gist options
  • Save Theaxiom/39f4af4fabd339ca9fd2e37afe212194 to your computer and use it in GitHub Desktop.
Save Theaxiom/39f4af4fabd339ca9fd2e37afe212194 to your computer and use it in GitHub Desktop.
Extending view method
<?php
namespace App\Controller\Api;
/**
* Releases Controller
*
* @property \App\Model\Table\ReleasesTable $Releases
*/
class ReleasesController extends ApiAppController
{
public function full($id)
{
$this->Crud->on('beforeFind', function(\Cake\Event\Event $event) {
$event->getSubject()->query->contain([
'Builds',
'Products',
'Builds.Artifacts'
]);
});
return $this->Crud->execute();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment