@@ -204,6 +204,10 @@ |
||
204 | 204 | return $return; |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param integer $level |
|
209 | + * @param string $opr |
|
210 | + */ |
|
207 | 211 | private function parseRightExpression($level, $opr) |
208 | 212 | { |
209 | 213 | switch ($opr) { |
@@ -103,6 +103,9 @@ |
||
103 | 103 | return $relationshipDetails; |
104 | 104 | } |
105 | 105 | |
106 | + /** |
|
107 | + * @param string $type |
|
108 | + */ |
|
106 | 109 | private function createRelationships($type, $relationships) |
107 | 110 | { |
108 | 111 | foreach ($relationships as $relationship) { |
@@ -17,5 +17,8 @@ |
||
17 | 17 | */ |
18 | 18 | interface ValidatorFactoryInterface |
19 | 19 | { |
20 | + /** |
|
21 | + * @return \ntentan\nibii\DefaultValidator |
|
22 | + */ |
|
20 | 23 | public function createModelValidator(RecordWrapper $model, $mode); |
21 | 24 | } |
@@ -89,6 +89,9 @@ |
||
89 | 89 | return $this->config; |
90 | 90 | } |
91 | 91 | |
92 | + /** |
|
93 | + * @param RecordWrapper $model |
|
94 | + */ |
|
92 | 95 | public function getModelDescription($model) : ModelDescription |
93 | 96 | { |
94 | 97 | return new ModelDescription($model); |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | use ntentan\atiaa\DbContext; |
30 | 30 | use ntentan\kaikai\Cache; |
31 | +use ntentan\nibii\exceptions\NibiiException; |
|
31 | 32 | use ntentan\nibii\interfaces\DriverAdapterFactoryInterface; |
32 | 33 | use ntentan\nibii\interfaces\ModelFactoryInterface; |
33 | 34 | use ntentan\nibii\interfaces\ValidatorFactoryInterface; |
34 | -use ntentan\nibii\exceptions\NibiiException; |
|
35 | 35 | use ntentan\panie\exceptions\ResolutionException; |
36 | 36 | |
37 | 37 | /** |
@@ -28,11 +28,22 @@ |
||
28 | 28 | |
29 | 29 | interface ModelFactoryInterface |
30 | 30 | { |
31 | + /** |
|
32 | + * @param string $name |
|
33 | + */ |
|
31 | 34 | public function createModel($name, $context); |
32 | 35 | |
36 | + /** |
|
37 | + * @param \ntentan\nibii\RecordWrapper $instance |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
33 | 41 | public function getModelTable($instance); |
34 | 42 | |
35 | 43 | public function getClassName($model); |
36 | 44 | |
45 | + /** |
|
46 | + * @return string |
|
47 | + */ |
|
37 | 48 | public function getJunctionClassName($classA, $classB); |
38 | 49 | } |
@@ -47,6 +47,9 @@ discard block |
||
47 | 47 | 'save', 'validate', |
48 | 48 | ]; |
49 | 49 | |
50 | + /** |
|
51 | + * @param string $table |
|
52 | + */ |
|
50 | 53 | public function __construct(RecordWrapper $wrapper, $table) |
51 | 54 | { |
52 | 55 | $this->wrapper = $wrapper; |
@@ -56,6 +59,9 @@ discard block |
||
56 | 59 | $this->queryOperations = new QueryOperations($wrapper, $this->dataOperations, $driver); |
57 | 60 | } |
58 | 61 | |
62 | + /** |
|
63 | + * @param string $name |
|
64 | + */ |
|
59 | 65 | public function perform($name, $arguments) |
60 | 66 | { |
61 | 67 | //@todo Think of using a hash here in future |
@@ -26,9 +26,9 @@ |
||
26 | 26 | |
27 | 27 | namespace ntentan\nibii\relationships; |
28 | 28 | |
29 | -use ntentan\nibii\exceptions\FieldNotFoundException; |
|
30 | 29 | use ntentan\nibii\ORMContext; |
31 | 30 | use ntentan\nibii\Relationship; |
31 | +use ntentan\nibii\exceptions\FieldNotFoundException; |
|
32 | 32 | use ntentan\utils\Text; |
33 | 33 | |
34 | 34 | /** |
@@ -74,7 +74,7 @@ |
||
74 | 74 | |
75 | 75 | public function preSave(&$wrapper, $value) |
76 | 76 | { |
77 | - if(!$value->save()) { |
|
77 | + if (!$value->save()) { |
|
78 | 78 | $this->invalidFields = $value->getInvalidFields(); |
79 | 79 | } |
80 | 80 | $wrapper[$this->options['local_key']] = $value[$this->options['foreign_key']]; |
@@ -139,7 +139,7 @@ |
||
139 | 139 | public function describe($model, $relationships) |
140 | 140 | { |
141 | 141 | return new ModelDescription( |
142 | - $this->driver->describeTable($table)[$table], $relationships, function ($type) { |
|
142 | + $this->driver->describeTable($table)[$table], $relationships, function($type) { |
|
143 | 143 | return $this->mapDataTypes($type); |
144 | 144 | } |
145 | 145 | ); |
@@ -26,7 +26,6 @@ |
||
26 | 26 | |
27 | 27 | namespace ntentan\nibii\relationships; |
28 | 28 | |
29 | -use ntentan\nibii\exceptions\NibiiException; |
|
30 | 29 | use ntentan\nibii\Relationship; |
31 | 30 | use ntentan\utils\Text; |
32 | 31 |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | { |
40 | 40 | // @todo throw an exception when the data doesn't have the local key |
41 | 41 | $query = $this->createQuery(); |
42 | - if(!$this->queryPrepared) { |
|
42 | + if (!$this->queryPrepared) { |
|
43 | 43 | $query->setTable($this->getModelInstance()->getDBStoreInformation()['quoted_table']) |
44 | 44 | ->addFilter($this->options['foreign_key'], $data[$this->options['local_key']] ?? null); |
45 | 45 | $this->queryPrepared = true; |
46 | 46 | return $query; |
47 | 47 | } |
48 | - if(isset($data[$this->options['local_key']])) { |
|
48 | + if (isset($data[$this->options['local_key']])) { |
|
49 | 49 | $query->setBoundData($this->options['foreign_key'], $data[$this->options['local_key']]); |
50 | 50 | } |
51 | 51 | return $query; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | public function postSave(&$wrapper) |
71 | 71 | { |
72 | 72 | $records = $this->tempData->getData(); |
73 | - foreach($records as $i => $relatedRecord) { |
|
73 | + foreach ($records as $i => $relatedRecord) { |
|
74 | 74 | $records[$i][$this->options['foreign_key']] = $wrapper[$this->options['local_key']]; |
75 | 75 | } |
76 | 76 | $this->tempData->setData($records); |
77 | - if(!$this->tempData->save()) { |
|
77 | + if (!$this->tempData->save()) { |
|
78 | 78 | $this->invalidFields = $this->tempData->getInvalidFields(); |
79 | 79 | } |
80 | 80 | $wrapper[$this->options['model']] = $this->tempData; |