Conditions | 2 |
Paths | 2 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 20 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
61 | 2 | protected function load($entityId) |
|
62 | { |
||
63 | 2 | $table = $this->getEntityDescriptor()->getTableName(); |
|
64 | 2 | $primaryKey = $this->getEntityDescriptor() |
|
65 | 2 | ->getPrimaryKey() |
|
66 | 2 | ->getField(); |
|
67 | |||
68 | 2 | $data = Sql::createSql($this->getAdapter()) |
|
69 | 2 | ->select($this->getEntityDescriptor()->getTableName()) |
|
70 | 2 | ->where( |
|
71 | [ |
||
|
|||
72 | 1 | "{$table}.{$primaryKey} = :id" => [ |
|
73 | 1 | ':id' => $entityId |
|
74 | 1 | ] |
|
75 | 1 | ] |
|
76 | 1 | ) |
|
77 | 2 | ->first(); |
|
78 | 2 | $entity = null; |
|
79 | 2 | if ($data) { |
|
80 | 2 | $entity = $this->getEntityMapper()->createFrom($data); |
|
81 | 2 | $this->getIdentityMap()->set($entity); |
|
82 | 1 | } |
|
83 | 2 | return $entity; |
|
84 | } |
||
85 | } |
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: