| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | public function onDelete(DependencyResultEvent $event) |
||
| 44 | { |
||
| 45 | $entity = $event->getEntity(); |
||
| 46 | |||
| 47 | if ($entity instanceOf Job) { |
||
| 48 | $repository = $event->getRepository('Applications'); |
||
| 49 | $entities = $repository->findBy(['isDraft' => null, 'job' => new \MongoId($entity->getId())]); |
||
| 50 | foreach ($entities as $ent) { $repository->remove($ent); } |
||
| 51 | return ['Applications', $entities, 'were removed.' ]; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 57 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: