Skip to content

Commit

Permalink
Applying query options before triggering beforeFind
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Aug 11, 2013
1 parent e0cad2a commit d30757f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/Cake/ORM/Table.php
Expand Up @@ -502,14 +502,13 @@ public function belongsToMany($associated, array $options = []) {
*/
public function find($type, $options = []) {
$query = $this->_buildQuery();
$query->select();
$query->select()->applyOptions($options);

$event = new Event('Model.beforeFind', $this, [$query, $options]);
$this->_eventManager->dispatch($event);
if ($event->isStopped()) {
return $query;
}
$query->applyOptions($options);
return $this->{'find' . ucfirst($type)}($query, $options);
}

Expand Down

0 comments on commit d30757f

Please sign in to comment.