| Conditions | 6 | 
| Paths | 5 | 
| Total Lines | 25 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 24 | public function beforeFind(Event $event, Query $query) | ||
| 25 |     {
 | ||
| 26 |         $field = $this->getConfig('field');
 | ||
| 27 | |||
| 28 |         if ($this->getTable()->hasField($field)) {
 | ||
| 29 | $deleted = true; | ||
| 30 | |||
| 31 |             if ($query->clause('where')) {
 | ||
| 32 |                 $query->clause('where')->traverse(function ($expression) use (&$deleted, $field) {
 | ||
| 33 |                     if ($expression instanceof Comparison) {
 | ||
| 34 |                         if ($expression->getField() === $this->getTable()->getAlias() . '.' . $field) {
 | ||
| 35 | $deleted = false; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | }); | ||
| 39 | } | ||
| 40 | |||
| 41 |             if ($deleted === true) {
 | ||
| 42 | $query->where([ | ||
| 43 | $this->getTable()->getAlias() . '.' . $field . ' IS NULL', | ||
| 44 | ]); | ||
| 45 | } | ||
| 46 | } | ||
| 47 | |||
| 48 | return $query; | ||
| 49 | } | ||
| 81 |