@@ -111,6 +111,11 @@ discard block |
||
| 111 | 111 | return $ret; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | + /** |
|
| 115 | + * @param string $member |
|
| 116 | + * @param string $class |
|
| 117 | + * @param string $part |
|
| 118 | + */ |
|
| 114 | 119 | private static function setToMember($member, $instance, $value, $class, $part) { |
| 115 | 120 | $accessor="set" . ucfirst($member); |
| 116 | 121 | if (method_exists($instance, $accessor)) { |
@@ -162,6 +167,10 @@ discard block |
||
| 162 | 167 | } |
| 163 | 168 | } |
| 164 | 169 | |
| 170 | + /** |
|
| 171 | + * @param string $class |
|
| 172 | + * @param ManyToManyParser $parser |
|
| 173 | + */ |
|
| 165 | 174 | private static function getManyToManyFromArray($instance, $array, $class, $parser) { |
| 166 | 175 | $ret=[]; |
| 167 | 176 | $continue=true; |
@@ -194,8 +203,6 @@ discard block |
||
| 194 | 203 | * Returns an array of $className objects from the database |
| 195 | 204 | * @param string $className class name of the model to load |
| 196 | 205 | * @param string $condition Part following the WHERE of an SQL statement |
| 197 | - * @param boolean $loadManyToOne if true, charges associate members with manyToOne association |
|
| 198 | - * @param boolean $loadOneToMany if true, charges associate members with oneToMany association |
|
| 199 | 206 | * @param boolean $useCache use the active cache if true |
| 200 | 207 | * @return array |
| 201 | 208 | */ |
@@ -249,6 +256,9 @@ discard block |
||
| 249 | 256 | return $objects; |
| 250 | 257 | } |
| 251 | 258 | |
| 259 | + /** |
|
| 260 | + * @param string $condition |
|
| 261 | + */ |
|
| 252 | 262 | public static function paginate($className,$page=1,$rowsPerPage=20,$condition=null){ |
| 253 | 263 | if(!isset($condition)){ |
| 254 | 264 | $condition="1=1"; |
@@ -309,7 +319,7 @@ discard block |
||
| 309 | 319 | * Returns the number of objects of $className from the database respecting the condition possibly passed as parameter |
| 310 | 320 | * @param string $className complete classname of the model to load |
| 311 | 321 | * @param string $condition Part following the WHERE of an SQL statement |
| 312 | - * @return int count of objects |
|
| 322 | + * @return string count of objects |
|
| 313 | 323 | */ |
| 314 | 324 | public static function count($className, $condition='') { |
| 315 | 325 | $tableName=OrmUtils::getTableName($className); |
@@ -7,6 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | trait DAORelationsTrait { |
| 9 | 9 | |
| 10 | + /** |
|
| 11 | + * @param boolean|null $useCache |
|
| 12 | + */ |
|
| 10 | 13 | private static function _affectsRelationObjects($manyToOneQueries,$oneToManyQueries,$manyToManyParsers,$objects,$included,$useCache){ |
| 11 | 14 | if(\sizeof($manyToOneQueries)>0){ |
| 12 | 15 | self::_affectsObjectsFromArray($manyToOneQueries, $objects,$included, function($object,$member,$manyToOneObjects,$fkField){ |
@@ -33,6 +36,9 @@ discard block |
||
| 33 | 36 | } |
| 34 | 37 | } |
| 35 | 38 | |
| 39 | + /** |
|
| 40 | + * @param \Closure $affectsCallback |
|
| 41 | + */ |
|
| 36 | 42 | private static function _affectsObjectsFromArray($queries,$objects,$included,$affectsCallback,$useCache=NULL){ |
| 37 | 43 | $includedNext=false; |
| 38 | 44 | foreach ($queries as $key=>$conditions){ |
@@ -150,6 +156,9 @@ discard block |
||
| 150 | 156 | $ret[$key][$value]=$fk . "='" . $value . "'"; |
| 151 | 157 | } |
| 152 | 158 | |
| 159 | + /** |
|
| 160 | + * @param boolean $included |
|
| 161 | + */ |
|
| 153 | 162 | private static function getIncludedForStep($included){ |
| 154 | 163 | if(is_bool($included)){ |
| 155 | 164 | return $included; |