| 1 | <?php |
||
| 23 | class Table extends \Bluz\Db\Table |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * Table |
||
| 27 | * |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $table = 'media'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Primary key(s) |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | protected $primary = array('id'); |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Get images of current user |
||
| 40 | * |
||
| 41 | * @return Row[] |
||
| 42 | * @throws Exception |
||
| 43 | */ |
||
| 44 | 1 | public function getImages() |
|
| 45 | { |
||
| 46 | /** @var Row $user */ |
||
| 47 | 1 | if (!$user = Auth::getIdentity()) { |
|
| 48 | throw new Exception('User not found'); |
||
| 49 | } |
||
| 50 | |||
| 51 | 1 | return $this->getImagesByUserId($user->id); |
|
|
|
|||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Get images by owner |
||
| 56 | * |
||
| 57 | * @param integer $id |
||
| 58 | * @return Row[] |
||
| 59 | */ |
||
| 60 | 1 | public function getImagesByUserId($id) |
|
| 67 | } |
||
| 68 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: