@@ -10,43 +10,43 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | interface ISpecificationCriteria |
| 12 | 12 | { |
| 13 | - public function getCriteria(); |
|
| 13 | + public function getCriteria(); |
|
| 14 | 14 | |
| 15 | 15 | public function getWhere(); |
| 16 | 16 | |
| 17 | - public function getLimit(); |
|
| 17 | + public function getLimit(); |
|
| 18 | 18 | |
| 19 | - public function getOfset(); |
|
| 19 | + public function getOfset(); |
|
| 20 | 20 | |
| 21 | - public function getJoins(); |
|
| 21 | + public function getJoins(); |
|
| 22 | 22 | |
| 23 | - public function getOrder(); |
|
| 23 | + public function getOrder(); |
|
| 24 | 24 | |
| 25 | - public function getManualJoins(); |
|
| 25 | + public function getManualJoins(); |
|
| 26 | 26 | |
| 27 | - public function getGroup(); |
|
| 27 | + public function getGroup(); |
|
| 28 | 28 | |
| 29 | - public function getManualWheres(); |
|
| 29 | + public function getManualWheres(); |
|
| 30 | 30 | |
| 31 | - public function getWhereType(); |
|
| 31 | + public function getWhereType(); |
|
| 32 | 32 | |
| 33 | - public function setWhere($field,$value = false); |
|
| 33 | + public function setWhere($field,$value = false); |
|
| 34 | 34 | |
| 35 | - public function setLimit($limit); |
|
| 35 | + public function setLimit($limit); |
|
| 36 | 36 | |
| 37 | - public function setOfset($ofset); |
|
| 37 | + public function setOfset($ofset); |
|
| 38 | 38 | |
| 39 | - public function setJoins($joins); |
|
| 39 | + public function setJoins($joins); |
|
| 40 | 40 | |
| 41 | - public function setOrder($order); |
|
| 41 | + public function setOrder($order); |
|
| 42 | 42 | |
| 43 | - public function setManualJoins($manualJoins); |
|
| 43 | + public function setManualJoins($manualJoins); |
|
| 44 | 44 | |
| 45 | - public function setGroup($group); |
|
| 45 | + public function setGroup($group); |
|
| 46 | 46 | |
| 47 | - public function setManualWheres($manualWheres); |
|
| 47 | + public function setManualWheres($manualWheres); |
|
| 48 | 48 | |
| 49 | - public function setWhereType($whereType); |
|
| 49 | + public function setWhereType($whereType); |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -10,134 +10,134 @@ |
||
| 10 | 10 | class Specification implements ISpecificationCriteria |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - protected $where = []; |
|
| 13 | + protected $where = []; |
|
| 14 | 14 | |
| 15 | - protected $limit = 0; |
|
| 15 | + protected $limit = 0; |
|
| 16 | 16 | |
| 17 | - protected $ofset = 0; |
|
| 17 | + protected $ofset = 0; |
|
| 18 | 18 | |
| 19 | - protected $joins = []; |
|
| 19 | + protected $joins = []; |
|
| 20 | 20 | |
| 21 | - protected $order = []; |
|
| 21 | + protected $order = []; |
|
| 22 | 22 | |
| 23 | - protected $manualJoins = []; |
|
| 23 | + protected $manualJoins = []; |
|
| 24 | 24 | |
| 25 | - protected $group = null; |
|
| 25 | + protected $group = null; |
|
| 26 | 26 | |
| 27 | - protected $manualWheres = []; |
|
| 27 | + protected $manualWheres = []; |
|
| 28 | 28 | |
| 29 | - protected $whereType = 'AND'; |
|
| 29 | + protected $whereType = 'AND'; |
|
| 30 | 30 | |
| 31 | - function getWhere() |
|
| 32 | - { |
|
| 33 | - return $this->where; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - function getLimit() |
|
| 37 | - { |
|
| 38 | - return $this->limit; |
|
| 39 | - } |
|
| 40 | - |
|
| 41 | - function getOfset() |
|
| 42 | - { |
|
| 43 | - return $this->ofset; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - function getJoins() |
|
| 47 | - { |
|
| 48 | - return $this->joins; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - function getOrder() |
|
| 52 | - { |
|
| 53 | - return $this->order; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - function getManualJoins() |
|
| 57 | - { |
|
| 58 | - return $this->manualJoins; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - function getGroup() |
|
| 62 | - { |
|
| 63 | - return $this->group; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - function getManualWheres() |
|
| 67 | - { |
|
| 68 | - return $this->manualWheres; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - function getWhereType() |
|
| 72 | - { |
|
| 73 | - return $this->whereType; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - function setWhere($field,$value = false) |
|
| 77 | - { |
|
| 78 | - if($value!==false){ |
|
| 79 | - $this->where[$field] = $value; |
|
| 80 | - } |
|
| 81 | - else{ |
|
| 82 | - $this->where = $where; |
|
| 83 | - } |
|
| 31 | + function getWhere() |
|
| 32 | + { |
|
| 33 | + return $this->where; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + function getLimit() |
|
| 37 | + { |
|
| 38 | + return $this->limit; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + function getOfset() |
|
| 42 | + { |
|
| 43 | + return $this->ofset; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + function getJoins() |
|
| 47 | + { |
|
| 48 | + return $this->joins; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + function getOrder() |
|
| 52 | + { |
|
| 53 | + return $this->order; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + function getManualJoins() |
|
| 57 | + { |
|
| 58 | + return $this->manualJoins; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + function getGroup() |
|
| 62 | + { |
|
| 63 | + return $this->group; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + function getManualWheres() |
|
| 67 | + { |
|
| 68 | + return $this->manualWheres; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + function getWhereType() |
|
| 72 | + { |
|
| 73 | + return $this->whereType; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + function setWhere($field,$value = false) |
|
| 77 | + { |
|
| 78 | + if($value!==false){ |
|
| 79 | + $this->where[$field] = $value; |
|
| 80 | + } |
|
| 81 | + else{ |
|
| 82 | + $this->where = $where; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return $this; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - function setLimit($limit) |
|
| 89 | - { |
|
| 90 | - $this->limit = $limit; |
|
| 91 | - return $this; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - function setOfset($ofset) |
|
| 95 | - { |
|
| 96 | - $this->ofset = $ofset; |
|
| 97 | - return $this; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - function setJoins($joins) |
|
| 101 | - { |
|
| 102 | - $this->joins = $joins; |
|
| 103 | - return $this; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - function setOrder($order) |
|
| 107 | - { |
|
| 108 | - $this->order = $order; |
|
| 109 | - return $this; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - function setManualJoins($manualJoins) |
|
| 113 | - { |
|
| 114 | - $this->manualJoins = $manualJoins; |
|
| 115 | - return $this; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - function setGroup($group) |
|
| 119 | - { |
|
| 120 | - $this->group = $group; |
|
| 121 | - return $this; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - function setManualWheres($manualWheres) |
|
| 125 | - { |
|
| 126 | - $this->manualWheres = $manualWheres; |
|
| 127 | - return $this; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - function setWhereType($whereType) |
|
| 131 | - { |
|
| 132 | - $this->whereType = $whereType; |
|
| 133 | - return $this; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Создание критериев |
|
| 138 | - */ |
|
| 139 | - public function getCriteria() |
|
| 140 | - { |
|
| 85 | + return $this; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + function setLimit($limit) |
|
| 89 | + { |
|
| 90 | + $this->limit = $limit; |
|
| 91 | + return $this; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + function setOfset($ofset) |
|
| 95 | + { |
|
| 96 | + $this->ofset = $ofset; |
|
| 97 | + return $this; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + function setJoins($joins) |
|
| 101 | + { |
|
| 102 | + $this->joins = $joins; |
|
| 103 | + return $this; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + function setOrder($order) |
|
| 107 | + { |
|
| 108 | + $this->order = $order; |
|
| 109 | + return $this; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + function setManualJoins($manualJoins) |
|
| 113 | + { |
|
| 114 | + $this->manualJoins = $manualJoins; |
|
| 115 | + return $this; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + function setGroup($group) |
|
| 119 | + { |
|
| 120 | + $this->group = $group; |
|
| 121 | + return $this; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + function setManualWheres($manualWheres) |
|
| 125 | + { |
|
| 126 | + $this->manualWheres = $manualWheres; |
|
| 127 | + return $this; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + function setWhereType($whereType) |
|
| 131 | + { |
|
| 132 | + $this->whereType = $whereType; |
|
| 133 | + return $this; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Создание критериев |
|
| 138 | + */ |
|
| 139 | + public function getCriteria() |
|
| 140 | + { |
|
| 141 | 141 | |
| 142 | - } |
|
| 142 | + } |
|
| 143 | 143 | } |
@@ -10,15 +10,15 @@ |
||
| 10 | 10 | interface RepositoryInterface |
| 11 | 11 | { |
| 12 | 12 | |
| 13 | - public function findById($id); |
|
| 13 | + public function findById($id); |
|
| 14 | 14 | |
| 15 | - public function findBySpecification(ISpecificationCriteria $specification); |
|
| 15 | + public function findBySpecification(ISpecificationCriteria $specification); |
|
| 16 | 16 | |
| 17 | - public function findAll(); |
|
| 17 | + public function findAll(); |
|
| 18 | 18 | |
| 19 | - public function findAllBySpecification(ISpecificationCriteria $specification); |
|
| 19 | + public function findAllBySpecification(ISpecificationCriteria $specification); |
|
| 20 | 20 | |
| 21 | - public function save(EntityInterface $Entity); |
|
| 21 | + public function save(EntityInterface $Entity); |
|
| 22 | 22 | |
| 23 | - public function delete(EntityInterface $Entity); |
|
| 23 | + public function delete(EntityInterface $Entity); |
|
| 24 | 24 | } |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | interface EntityInterface |
| 10 | 10 | { |
| 11 | - //put your code here |
|
| 12 | - public function getId(); |
|
| 11 | + //put your code here |
|
| 12 | + public function getId(); |
|
| 13 | 13 | |
| 14 | - public function setId($id); |
|
| 14 | + public function setId($id); |
|
| 15 | 15 | |
| 16 | - public function getDeleted(); |
|
| 16 | + public function getDeleted(); |
|
| 17 | 17 | |
| 18 | - public function setDeleted($delete); |
|
| 18 | + public function setDeleted($delete); |
|
| 19 | 19 | } |
@@ -66,6 +66,9 @@ discard block |
||
| 66 | 66 | return $this->adapter->delete($table,$where); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | + /** |
|
| 70 | + * @param string $str |
|
| 71 | + */ |
|
| 69 | 72 | protected function escape_str($str, $like = FALSE) |
| 70 | 73 | { |
| 71 | 74 | |
@@ -120,7 +123,6 @@ discard block |
||
| 120 | 123 | |
| 121 | 124 | /** |
| 122 | 125 | * |
| 123 | - * @param type $param |
|
| 124 | 126 | */ |
| 125 | 127 | public function getResultQuery($table,\SimpleORM\ISpecificationCriteria $Criteria ) { |
| 126 | 128 | |
@@ -155,7 +157,7 @@ discard block |
||
| 155 | 157 | /** |
| 156 | 158 | * Создает селект не только для основной таблицы но и для приджойненых таблиц |
| 157 | 159 | * @param type $joins |
| 158 | - * @return type |
|
| 160 | + * @return string |
|
| 159 | 161 | */ |
| 160 | 162 | protected function createSelect($joins) |
| 161 | 163 | { |
@@ -171,8 +173,8 @@ discard block |
||
| 171 | 173 | /** |
| 172 | 174 | * Получение записей по условию |
| 173 | 175 | * @param type $where |
| 174 | - * @param type $limit |
|
| 175 | - * @param type $offset |
|
| 176 | + * @param integer $limit |
|
| 177 | + * @param integer $offset |
|
| 176 | 178 | * @param type $joins |
| 177 | 179 | * @param type $order |
| 178 | 180 | * @param type $manualJoins |
@@ -5,8 +5,8 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * получение защищенного свойства |
| 8 | - * @param type $o |
|
| 9 | - * @param type $name |
|
| 8 | + * @param string $name |
|
| 9 | + * @param SimpleORM\AbstractDataMapper $obj |
|
| 10 | 10 | * @return type |
| 11 | 11 | */ |
| 12 | 12 | static public function getProtectedAttribute($obj, $name) |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Добавление значения в защищенное свойтсво |
| 22 | 22 | * @param type $name |
| 23 | - * @param type $valued |
|
| 23 | + * @param type $value |
|
| 24 | 24 | */ |
| 25 | 25 | private function setValueprotectedProperty($name, $value) |
| 26 | 26 | { |
@@ -30,6 +30,10 @@ discard block |
||
| 30 | 30 | $r->setValue($this->object, $value); //изменяем значение |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | + /** |
|
| 34 | + * @param SimpleORM\AbstractDataMapper $obj |
|
| 35 | + * @param string $name |
|
| 36 | + */ |
|
| 33 | 37 | static public function callMethod($obj, $name, array $args) { |
| 34 | 38 | $class = new \ReflectionClass($obj); |
| 35 | 39 | $method = $class->getMethod($name); |
@@ -3,38 +3,38 @@ |
||
| 3 | 3 | |
| 4 | 4 | class TestHelper{ |
| 5 | 5 | |
| 6 | - /** |
|
| 7 | - * получение защищенного свойства |
|
| 8 | - * @param type $o |
|
| 9 | - * @param type $name |
|
| 10 | - * @return type |
|
| 11 | - */ |
|
| 12 | - static public function getProtectedAttribute($obj, $name) |
|
| 13 | - { |
|
| 14 | - $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
| 15 | - $r = $reflectionClass->getProperty($name); //получаем свойство |
|
| 16 | - $r->setAccessible(true); //делаем открытым |
|
| 17 | - return $r->getValue($obj); |
|
| 18 | - } |
|
| 6 | + /** |
|
| 7 | + * получение защищенного свойства |
|
| 8 | + * @param type $o |
|
| 9 | + * @param type $name |
|
| 10 | + * @return type |
|
| 11 | + */ |
|
| 12 | + static public function getProtectedAttribute($obj, $name) |
|
| 13 | + { |
|
| 14 | + $reflectionClass = new \ReflectionClass($obj); //создаем reflectionClass |
|
| 15 | + $r = $reflectionClass->getProperty($name); //получаем свойство |
|
| 16 | + $r->setAccessible(true); //делаем открытым |
|
| 17 | + return $r->getValue($obj); |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Добавление значения в защищенное свойтсво |
|
| 22 | - * @param type $name |
|
| 23 | - * @param type $valued |
|
| 24 | - */ |
|
| 25 | - private function setValueprotectedProperty($name, $value) |
|
| 26 | - { |
|
| 27 | - $reflectionClass = new \ReflectionClass($this->object); //создаем reflectionClass |
|
| 28 | - $r = $reflectionClass->getProperty($name); //получаем свойство |
|
| 29 | - $r->setAccessible(true); //делаем открытым |
|
| 30 | - $r->setValue($this->object, $value); //изменяем значение |
|
| 31 | - } |
|
| 20 | + /** |
|
| 21 | + * Добавление значения в защищенное свойтсво |
|
| 22 | + * @param type $name |
|
| 23 | + * @param type $valued |
|
| 24 | + */ |
|
| 25 | + private function setValueprotectedProperty($name, $value) |
|
| 26 | + { |
|
| 27 | + $reflectionClass = new \ReflectionClass($this->object); //создаем reflectionClass |
|
| 28 | + $r = $reflectionClass->getProperty($name); //получаем свойство |
|
| 29 | + $r->setAccessible(true); //делаем открытым |
|
| 30 | + $r->setValue($this->object, $value); //изменяем значение |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | static public function callMethod($obj, $name, array $args) { |
| 34 | - $class = new \ReflectionClass($obj); |
|
| 35 | - $method = $class->getMethod($name); |
|
| 36 | - $method->setAccessible(true); |
|
| 37 | - return $method->invokeArgs($obj, $args); |
|
| 38 | - } |
|
| 34 | + $class = new \ReflectionClass($obj); |
|
| 35 | + $method = $class->getMethod($name); |
|
| 36 | + $method->setAccessible(true); |
|
| 37 | + return $method->invokeArgs($obj, $args); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | //----------------- |
| 59 | 59 | $mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields'); |
| 60 | 60 | |
| 61 | - $this->assertEquals($mapping_fields, $correct); |
|
| 61 | + $this->assertEquals($mapping_fields, $correct); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | //----------------- |
| 78 | 78 | $mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields'); |
| 79 | 79 | |
| 80 | - $this->assertEquals($mapping_fields, $correct); |
|
| 80 | + $this->assertEquals($mapping_fields, $correct); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | //----------------- |
| 99 | 99 | $mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields'); |
| 100 | 100 | |
| 101 | - $this->assertEquals($mapping_fields, $correct); |
|
| 101 | + $this->assertEquals($mapping_fields, $correct); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | //----------------- |
| 122 | 122 | $mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields'); |
| 123 | 123 | |
| 124 | - $this->assertEquals($mapping_fields, $correct); |
|
| 124 | + $this->assertEquals($mapping_fields, $correct); |
|
| 125 | 125 | |
| 126 | 126 | $key_field = \TestHelper::getProtectedAttribute($this->object,'key'); |
| 127 | 127 | $this->assertEquals($key_field, 'tb_mayfield'); |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | //----------------- |
| 148 | 148 | $mapping_fields = \TestHelper::getProtectedAttribute($this->object,'mapping_fields'); |
| 149 | 149 | |
| 150 | - $this->assertEquals($mapping_fields, $correct); |
|
| 150 | + $this->assertEquals($mapping_fields, $correct); |
|
| 151 | 151 | |
| 152 | 152 | $soft_delete_key = \TestHelper::getProtectedAttribute($this->object,'soft_delete_key'); |
| 153 | 153 | $this->assertEquals($soft_delete_key, 'tb_mayfield'); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * таблица для сущности |
| 20 | 20 | * @var type |
| 21 | 21 | */ |
| 22 | - protected $entityTable; |
|
| 22 | + protected $entityTable; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * первичный ключ |
@@ -88,9 +88,9 @@ discard block |
||
| 88 | 88 | |
| 89 | 89 | abstract protected function setMappingFields(); |
| 90 | 90 | |
| 91 | - public function getAdapter() { |
|
| 92 | - return $this->adapter; |
|
| 93 | - } |
|
| 91 | + public function getAdapter() { |
|
| 92 | + return $this->adapter; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | 95 | public function setAdapter(QueryBuilderInterface $adapter){ |
| 96 | 96 | $this->adapter = $adapter; |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
| 112 | - public function findById($id) |
|
| 113 | - { |
|
| 112 | + public function findById($id) |
|
| 113 | + { |
|
| 114 | 114 | $Criteria = (new Specification())->setWhere($this->key , $id); |
| 115 | 115 | |
| 116 | - return $this->findBySpecification($Criteria); |
|
| 117 | - } |
|
| 116 | + return $this->findBySpecification($Criteria); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Cохранение сущности |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | */ |
| 211 | 211 | protected function buildEntity(EntityInterface $Entity, array $row){ |
| 212 | 212 | |
| 213 | - foreach ($this->mapping_fields as $alias => $cfg ) { |
|
| 213 | + foreach ($this->mapping_fields as $alias => $cfg ) { |
|
| 214 | 214 | |
| 215 | 215 | $value = false; |
| 216 | 216 | |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | if($value!==false) |
| 248 | 248 | $Entity->{$method_set}($value); |
| 249 | 249 | |
| 250 | - } |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - return $Entity; |
|
| 252 | + return $Entity; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | $row = []; |
| 265 | 265 | |
| 266 | - foreach ($this->mapping_fields as $alias => $cfg ) { |
|
| 266 | + foreach ($this->mapping_fields as $alias => $cfg ) { |
|
| 267 | 267 | |
| 268 | 268 | $field = $cfg['field']; |
| 269 | 269 | |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | $row[$field] = $value; |
| 295 | 295 | |
| 296 | - } |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - return $row; |
|
| 298 | + return $row; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | //получение записей |
| 368 | 368 | $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification); |
| 369 | 369 | |
| 370 | - if (!$row = $res->row_array()) { |
|
| 371 | - return null; |
|
| 372 | - } |
|
| 373 | - return $this->createEntity($row); |
|
| 370 | + if (!$row = $res->row_array()) { |
|
| 371 | + return null; |
|
| 372 | + } |
|
| 373 | + return $this->createEntity($row); |
|
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /** |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | $res = $this->getAdapter()->getResultQuery($this->getEntityTable(),$specification); |
| 413 | 413 | |
| 414 | 414 | if (!$rows = $res->result_array()) { |
| 415 | - return null; |
|
| 416 | - } |
|
| 415 | + return null; |
|
| 416 | + } |
|
| 417 | 417 | |
| 418 | 418 | foreach($rows as $k => $row){ |
| 419 | 419 | $rows[$k] = $this->createEntity($row); |
@@ -303,9 +303,9 @@ discard block |
||
| 303 | 303 | /** |
| 304 | 304 | * Подготавливаем конечный вариант Сущности |
| 305 | 305 | * |
| 306 | - * @param \Core\Infrastructure\EntityInterface $Entity |
|
| 306 | + * @param EntityInterface $Entity |
|
| 307 | 307 | * @param array $row |
| 308 | - * @return \Core\Infrastructure\EntityInterface |
|
| 308 | + * @return EntityInterface |
|
| 309 | 309 | * @throws BadMethodCallException |
| 310 | 310 | */ |
| 311 | 311 | protected function buildEntity(EntityInterface $Entity, array $row){ |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | /** |
| 357 | 357 | * из объекта формирует массив |
| 358 | - * @param \Core\Infrastructure\EntityInterface $Entity |
|
| 358 | + * @param EntityInterface $Entity |
|
| 359 | 359 | * @return \Core\Infrastructure\EntityInterface |
| 360 | 360 | * @throws BadMethodCallException |
| 361 | 361 | */ |
@@ -400,6 +400,7 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | 402 | * Установка поля для маппинга |
| 403 | + * @param string $alias |
|
| 403 | 404 | */ |
| 404 | 405 | protected function addMappingField($alias,$field = null){ |
| 405 | 406 | |
@@ -18,6 +18,10 @@ |
||
| 18 | 18 | |
| 19 | 19 | protected $title; |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $code |
|
| 23 | + * @param string $title |
|
| 24 | + */ |
|
| 21 | 25 | function __construct($code,$title){ |
| 22 | 26 | $this->setCode($code); |
| 23 | 27 | $this->setTitle($title); |