@@ -227,6 +227,9 @@ |
||
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | + /** |
|
| 231 | + * @param string $event |
|
| 232 | + */ |
|
| 230 | 233 | private function runBehaviours($event, $args) { |
| 231 | 234 | foreach ($this->wrapper->getBehaviours() as $behaviour) { |
| 232 | 235 | $args[0] = call_user_func_array([$behaviour, $event], $args); |
@@ -118,6 +118,9 @@ |
||
| 118 | 118 | return $this->queryEngine; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | + /** |
|
| 122 | + * @param RecordWrapper $model |
|
| 123 | + */ |
|
| 121 | 124 | public function setModel($model) { |
| 122 | 125 | $this->modelInstance = $model; |
| 123 | 126 | } |
@@ -190,6 +190,10 @@ |
||
| 190 | 190 | return $return; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | + /** |
|
| 194 | + * @param integer $level |
|
| 195 | + * @param string $opr |
|
| 196 | + */ |
|
| 193 | 197 | private function parseRightExpression($level, $opr) { |
| 194 | 198 | switch ($opr) { |
| 195 | 199 | case 'between': return $this->parseBetween(); |
@@ -90,6 +90,9 @@ |
||
| 90 | 90 | return $relationshipDetails; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + /** |
|
| 94 | + * @param string $type |
|
| 95 | + */ |
|
| 93 | 96 | private function createRelationships($type, $relationships) { |
| 94 | 97 | foreach ($relationships as $relationship) { |
| 95 | 98 | $relationship = $this->getRelationshipDetails($relationship); |
@@ -22,6 +22,11 @@ |
||
| 22 | 22 | 'save' |
| 23 | 23 | ]; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param RecordWrapper $wrapper |
|
| 27 | + * @param DriverAdapter $adapter |
|
| 28 | + * @param string $table |
|
| 29 | + */ |
|
| 25 | 30 | public function __construct($wrapper, $adapter, $table) { |
| 26 | 31 | $this->wrapper = $wrapper; |
| 27 | 32 | $this->adapter = $adapter; |
@@ -6,10 +6,16 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | private $db; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param \ntentan\atiaa\Driver $driver |
|
| 11 | + */ |
|
| 9 | 12 | public function setDriver($driver) { |
| 10 | 13 | $this->db = $driver; |
| 11 | 14 | } |
| 12 | 15 | |
| 16 | + /** |
|
| 17 | + * @param string $query |
|
| 18 | + */ |
|
| 13 | 19 | private function filter($query) { |
| 14 | 20 | return $query; |
| 15 | 21 | } |
@@ -39,6 +45,9 @@ discard block |
||
| 39 | 45 | ); |
| 40 | 46 | } |
| 41 | 47 | |
| 48 | + /** |
|
| 49 | + * @return string |
|
| 50 | + */ |
|
| 42 | 51 | public function getBulkUpdateQuery($data, $parameters) { |
| 43 | 52 | $updateData = []; |
| 44 | 53 | foreach ($data as $field => $value) { |
@@ -84,6 +93,9 @@ discard block |
||
| 84 | 93 | ); |
| 85 | 94 | } |
| 86 | 95 | |
| 96 | + /** |
|
| 97 | + * @return string |
|
| 98 | + */ |
|
| 87 | 99 | public function getSelectQuery($parameters) { |
| 88 | 100 | return $this->filter(sprintf( |
| 89 | 101 | "SELECT %s FROM %s%s%s%s%s", |
@@ -97,6 +109,9 @@ discard block |
||
| 97 | 109 | ); |
| 98 | 110 | } |
| 99 | 111 | |
| 112 | + /** |
|
| 113 | + * @return string |
|
| 114 | + */ |
|
| 100 | 115 | public function getCountQuery($parameters) { |
| 101 | 116 | return $this->filter(sprintf( |
| 102 | 117 | "SELECT count(*) as count FROM %s%s", |
@@ -106,6 +121,9 @@ discard block |
||
| 106 | 121 | ); |
| 107 | 122 | } |
| 108 | 123 | |
| 124 | + /** |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 109 | 127 | public function getDeleteQuery($parameters) { |
| 110 | 128 | return $this->filter(sprintf( |
| 111 | 129 | "DELETE FROM %s%s", |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * |
| 26 | - * @param \ $model |
|
| 26 | + * @param string $table |
|
| 27 | 27 | */ |
| 28 | 28 | public function __construct($table) { |
| 29 | 29 | $this->db = DriverAdapter::getDefaultInstance(); |
@@ -106,6 +106,9 @@ discard block |
||
| 106 | 106 | $this->boundData += $values; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | + /** |
|
| 110 | + * @param boolean $firstOnly |
|
| 111 | + */ |
|
| 109 | 112 | public function setFirstOnly($firstOnly) { |
| 110 | 113 | $this->firstOnly = $firstOnly; |
| 111 | 114 | return $this; |
@@ -123,6 +126,9 @@ discard block |
||
| 123 | 126 | $this->offset = $offset; |
| 124 | 127 | } |
| 125 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $field |
|
| 131 | + */ |
|
| 126 | 132 | public function addSort($field, $direction = 'ASC') { |
| 127 | 133 | $this->sorts[] = "$field $direction"; |
| 128 | 134 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @method |
| 125 | - * @param type $name |
|
| 125 | + * @param string $name |
|
| 126 | 126 | * @param type $arguments |
| 127 | 127 | * @return type |
| 128 | 128 | */ |
@@ -148,6 +148,10 @@ discard block |
||
| 148 | 148 | return $this->retrieveItem($name); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | + /** |
|
| 152 | + * @param Relationship[] $relationships |
|
| 153 | + * @param integer $depth |
|
| 154 | + */ |
|
| 151 | 155 | private function expandArrayValue($array, $relationships, $depth, $index = null) { |
| 152 | 156 | foreach ($relationships as $name => $relationship) { |
| 153 | 157 | $array[$name] = $this->fetchRelatedFields($relationship, $index)->toArray($depth); |