Skip to content

Instantly share code, notes, and snippets.

@derekperkins
Created June 23, 2014 21:10
Show Gist options
  • Save derekperkins/0093f9165be24e383ad3 to your computer and use it in GitHub Desktop.
Save derekperkins/0093f9165be24e383ad3 to your computer and use it in GitHub Desktop.
<?php
class TeamRoleBehavior extends ModelBehavior {
// Enable custom finds in Behavior
public $mapMethods = array(
'/teamAncestors/' => 'teamAncestors',
'/teamDescendants/' => 'teamDescendants',
);
public function setup(Model $Model, $config = array()) {
$Model->findMethods['teamAncestors'] = true;
$Model->findMethods['teamDescendants'] = true;
}
public function findTeamAncestors($Model, $state, $query, $results = array()) {
...
}
public function findTeamDescendants($Model, $state, $query, $results = array()) {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment