|
4 | 4 |
|
5 | 5 | namespace CoolBeans; |
6 | 6 |
|
7 | | -use \CoolBeans\Contract\PrimaryKey; |
8 | | - |
9 | 7 | abstract class Bean implements \CoolBeans\Contract\Row, \IteratorAggregate |
10 | 8 | { |
11 | 9 | use \Nette\SmartObject; |
12 | 10 |
|
13 | | - protected \Nette\Database\Table\ActiveRow $row; |
14 | 11 | protected \ReflectionClass $reflection; |
15 | | - protected PrimaryKey $primaryKey; |
| 12 | + protected \CoolBeans\Contract\PrimaryKey $primaryKey; |
16 | 13 |
|
17 | | - public function __construct(\Nette\Database\Table\ActiveRow $row) |
| 14 | + public function __construct( |
| 15 | + protected \Nette\Database\Table\ActiveRow $row, |
| 16 | + ) |
18 | 17 | { |
19 | | - $this->row = $row; |
20 | 18 | $this->reflection = new \ReflectionClass(static::class); |
21 | | - $this->primaryKey = PrimaryKey::create($this->row); |
| 19 | + $this->primaryKey = \CoolBeans\Contract\PrimaryKey::create($this->row); |
22 | 20 |
|
23 | 21 | if (\CoolBeans\Config::$validateColumns) { |
24 | 22 | $this->validateMissingColumns(); |
@@ -50,7 +48,7 @@ public function toArray() : array |
50 | 48 | /** |
51 | 49 | * Returns primary key object. |
52 | 50 | */ |
53 | | - public function getPrimaryKey() : PrimaryKey |
| 51 | + public function getPrimaryKey() : \CoolBeans\Contract\PrimaryKey |
54 | 52 | { |
55 | 53 | return $this->primaryKey; |
56 | 54 | } |
@@ -84,7 +82,7 @@ public function offsetExists($offset) : bool |
84 | 82 | $property = $this->reflection->getProperty($offset); |
85 | 83 |
|
86 | 84 | return $property->isPublic(); |
87 | | - } catch (\ReflectionException $e) { |
| 85 | + } catch (\ReflectionException) { |
88 | 86 | return false; |
89 | 87 | } |
90 | 88 | } |
|
0 commit comments