Browse Source

Fixing bug where beforeFind was being triggered for delete queries

Jose Lorenzo Rodriguez 11 years ago
parent
commit
2a9dd2276d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/ORM/Query.php

+ 1 - 1
src/ORM/Query.php

@@ -609,7 +609,7 @@ class Query extends DatabaseQuery implements JsonSerializable {
 	public function sql(ValueBinder $binder = null) {
 		$this->_transformQuery();
 
-		if (!$this->_beforeFindFired) {
+		if (!$this->_beforeFindFired && $this->_type === 'select') {
 			$table = $this->repository();
 			$table->dispatchEvent('Model.beforeFind', [$this, $this->_options, !$this->eagerLoaded()]);
 			$this->_beforeFindFired = true;