| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 50 | protected function load($entityId) |
||
| 51 | { |
||
| 52 | $table = $this->getEntityDescriptor()->getTableName(); |
||
| 53 | $primaryKey = $this->getEntityDescriptor() |
||
| 54 | ->getPrimaryKey() |
||
| 55 | ->getField(); |
||
| 56 | |||
| 57 | $data = Sql::createSql($this->getAdapter()) |
||
| 58 | ->select($this->getEntityDescriptor()->getTableName()) |
||
| 59 | ->where( |
||
| 60 | [ |
||
|
|
|||
| 61 | "{$table}.{$primaryKey} = :id" => [ |
||
| 62 | ':id' => $entityId |
||
| 63 | ] |
||
| 64 | ] |
||
| 65 | ) |
||
| 66 | ->first(); |
||
| 67 | $entity = null; |
||
| 68 | if ($data) { |
||
| 69 | $entity = $this->getEntityMapper()->createFrom($data); |
||
| 70 | $this->getIdentityMap()->set($entity); |
||
| 71 | } |
||
| 72 | return $entity; |
||
| 73 | } |
||
| 74 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: