@@ -143,6 +143,10 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | abstract public function performAction($args); |
| 145 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $dir |
|
| 148 | + * @param integer $mask |
|
| 149 | + */ |
|
| 146 | 150 | protected function createDirectory($dir, $mask) |
| 147 | 151 | { |
| 148 | 152 | if(!is_dir($dir)) |
@@ -154,6 +158,9 @@ discard block |
||
| 154 | 158 | chmod($dir, $mask); |
| 155 | 159 | } |
| 156 | 160 | |
| 161 | + /** |
|
| 162 | + * @param string $filename |
|
| 163 | + */ |
|
| 157 | 164 | protected function createFile($filename, $content) |
| 158 | 165 | { |
| 159 | 166 | if(!is_file($filename)) |
@@ -302,6 +309,9 @@ discard block |
||
| 302 | 309 | '; |
| 303 | 310 | } |
| 304 | 311 | |
| 312 | + /** |
|
| 313 | + * @param string $appName |
|
| 314 | + */ |
|
| 305 | 315 | protected function renderConfigFile($appName) |
| 306 | 316 | { |
| 307 | 317 | return <<<EOD |
@@ -515,6 +525,9 @@ discard block |
||
| 515 | 525 | return false; |
| 516 | 526 | } |
| 517 | 527 | |
| 528 | + /** |
|
| 529 | + * @param string $app_dir |
|
| 530 | + */ |
|
| 518 | 531 | protected function getActiveRecordConfig($app_dir) |
| 519 | 532 | { |
| 520 | 533 | if(false === ($xml = $this->getXmlFile($app_dir))) |
@@ -530,6 +543,9 @@ discard block |
||
| 530 | 543 | return false; |
| 531 | 544 | } |
| 532 | 545 | |
| 546 | + /** |
|
| 547 | + * @param string $app_dir |
|
| 548 | + */ |
|
| 533 | 549 | protected function getOutputFile($app_dir, $namespace) |
| 534 | 550 | { |
| 535 | 551 | if(is_file($namespace) && strpos($namespace, $app_dir) === 0) |
@@ -591,6 +607,9 @@ discard block |
||
| 591 | 607 | return $prop; |
| 592 | 608 | } |
| 593 | 609 | |
| 610 | + /** |
|
| 611 | + * @param string $class |
|
| 612 | + */ |
|
| 594 | 613 | protected function generateClass($properties, $tablename, $class) |
| 595 | 614 | { |
| 596 | 615 | $props = implode("\n", $properties); |
@@ -686,6 +705,9 @@ discard block |
||
| 686 | 705 | return true; |
| 687 | 706 | } |
| 688 | 707 | |
| 708 | + /** |
|
| 709 | + * @param string $l |
|
| 710 | + */ |
|
| 689 | 711 | public function generate($l) |
| 690 | 712 | { |
| 691 | 713 | $input = explode(" ", trim($l)); |
@@ -724,6 +746,9 @@ discard block |
||
| 724 | 746 | return false; |
| 725 | 747 | } |
| 726 | 748 | |
| 749 | + /** |
|
| 750 | + * @param string $app_dir |
|
| 751 | + */ |
|
| 727 | 752 | protected function getActiveRecordConfig($app_dir) { |
| 728 | 753 | if (false === ($xml = $this->getXmlFile($app_dir))) |
| 729 | 754 | return false; |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | $valid |= $action->performAction($args); |
| 105 | 105 | break; |
| 106 | - } |
|
| 107 | - else |
|
| 106 | + } else |
|
| 108 | 107 | { |
| 109 | 108 | $valid = false; |
| 110 | 109 | } |
@@ -205,8 +204,7 @@ discard block |
||
| 205 | 204 | } |
| 206 | 205 | |
| 207 | 206 | return Prado::getApplication(); |
| 208 | - } |
|
| 209 | - else |
|
| 207 | + } else |
|
| 210 | 208 | { |
| 211 | 209 | PradoCommandLineInterpreter::printGreeting(); |
| 212 | 210 | echo '+' . str_repeat('-', 77) . "+\n"; |
@@ -554,8 +552,7 @@ discard block |
||
| 554 | 552 | { |
| 555 | 553 | echo '** Unable to find table or view "' . $tablename . '" in "' . $manager->getDbConnection()->getConnectionString() . "\".\n"; |
| 556 | 554 | return false; |
| 557 | - } |
|
| 558 | - else |
|
| 555 | + } else |
|
| 559 | 556 | { |
| 560 | 557 | $properties = []; |
| 561 | 558 | foreach($tableInfo->getColumns() as $field => $column) |
@@ -699,8 +696,7 @@ discard block |
||
| 699 | 696 | $args = [$input[0],$input[1], $input[2],$app_dir,'soap']; |
| 700 | 697 | $cmd = new PradoCommandLineActiveRecordGen; |
| 701 | 698 | $cmd->performAction($args); |
| 702 | - } |
|
| 703 | - else |
|
| 699 | + } else |
|
| 704 | 700 | { |
| 705 | 701 | echo "\n Usage: generate table_name Application.pages.RecordClassName\n"; |
| 706 | 702 | } |
@@ -47,6 +47,7 @@ |
||
| 47 | 47 | * @param mixed the value to be cached |
| 48 | 48 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 49 | 49 | * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labelled invalid. |
| 50 | + * @param string $id |
|
| 50 | 51 | * @return boolean true if the value is successfully stored into cache, false otherwise |
| 51 | 52 | */ |
| 52 | 53 | public function add($id, $value, $expire = 0, $dependency = null); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @param string a key identifying a value to be cached |
| 113 | - * @return sring a key generated from the provided key which ensures the uniqueness across applications |
|
| 113 | + * @return string a key generated from the provided key which ensures the uniqueness across applications |
|
| 114 | 114 | */ |
| 115 | 115 | protected function generateUniqueKey($key) |
| 116 | 116 | { |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param mixed the value to be cached |
| 145 | 145 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 146 | 146 | * @param ICacheDependency dependency of the cached item. If the dependency changes, the item is labeled invalid. |
| 147 | - * @return boolean true if the value is successfully stored into cache, false otherwise |
|
| 147 | + * @return null|boolean true if the value is successfully stored into cache, false otherwise |
|
| 148 | 148 | */ |
| 149 | 149 | public function set($id, $value, $expire = 0, $dependency = null) |
| 150 | 150 | { |
@@ -202,6 +202,7 @@ discard block |
||
| 202 | 202 | * in {@link get()} already. So only the implementation of data retrieval |
| 203 | 203 | * is needed. |
| 204 | 204 | * @param string a unique key identifying the cached value |
| 205 | + * @param string $key |
|
| 205 | 206 | * @return string the value stored in cache, false if the value is not in the cache or expired. |
| 206 | 207 | */ |
| 207 | 208 | abstract protected function getValue($key); |
@@ -216,6 +217,8 @@ discard block |
||
| 216 | 217 | * @param string the key identifying the value to be cached |
| 217 | 218 | * @param string the value to be cached |
| 218 | 219 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 220 | + * @param string $key |
|
| 221 | + * @param integer $expire |
|
| 219 | 222 | * @return boolean true if the value is successfully stored into cache, false otherwise |
| 220 | 223 | */ |
| 221 | 224 | abstract protected function setValue($key, $value, $expire); |
@@ -230,6 +233,8 @@ discard block |
||
| 230 | 233 | * @param string the key identifying the value to be cached |
| 231 | 234 | * @param string the value to be cached |
| 232 | 235 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 236 | + * @param string $key |
|
| 237 | + * @param integer $expire |
|
| 233 | 238 | * @return boolean true if the value is successfully stored into cache, false otherwise |
| 234 | 239 | */ |
| 235 | 240 | abstract protected function addValue($key, $value, $expire); |
@@ -238,6 +243,7 @@ discard block |
||
| 238 | 243 | * Deletes a value with the specified key from cache |
| 239 | 244 | * This method should be implemented by child classes to delete the data from actual cache storage. |
| 240 | 245 | * @param string the key of the value to be deleted |
| 246 | + * @param string $key |
|
| 241 | 247 | * @return boolean if no error happens during deletion |
| 242 | 248 | */ |
| 243 | 249 | abstract protected function deleteValue($key); |
@@ -281,7 +287,7 @@ discard block |
||
| 281 | 287 | * Deletes the value with the specified key from cache |
| 282 | 288 | * This method is required by the interface \ArrayAccess. |
| 283 | 289 | * @param string the key of the value to be deleted |
| 284 | - * @return boolean if no error happens during deletion |
|
| 290 | + * @return boolean|null if no error happens during deletion |
|
| 285 | 291 | */ |
| 286 | 292 | public function offsetUnset($id) |
| 287 | 293 | { |
@@ -124,6 +124,7 @@ discard block |
||
| 124 | 124 | * By default, it always returns true, meaning the file should be checked. |
| 125 | 125 | * You may override this method to check only certain files. |
| 126 | 126 | * @param string the name of the file that may be checked for dependency. |
| 127 | + * @param string $fileName |
|
| 127 | 128 | * @return boolean whether this file should be checked. |
| 128 | 129 | */ |
| 129 | 130 | protected function validateFile($fileName) |
@@ -137,6 +138,7 @@ discard block |
||
| 137 | 138 | * By default, it always returns true, meaning the subdirectory should be checked. |
| 138 | 139 | * You may override this method to check only certain subdirectories. |
| 139 | 140 | * @param string the name of the subdirectory that may be checked for dependency. |
| 141 | + * @param string $directory |
|
| 140 | 142 | * @return boolean whether this subdirectory should be checked. |
| 141 | 143 | */ |
| 142 | 144 | protected function validateDirectory($directory) |
@@ -150,6 +152,7 @@ discard block |
||
| 150 | 152 | * {@link setRecursiveCheck RecursiveCheck} is set true. |
| 151 | 153 | * @param string the directory name |
| 152 | 154 | * @param int level of the recursion |
| 155 | + * @param string $directory |
|
| 153 | 156 | * @return array list of file modification time indexed by the file path |
| 154 | 157 | */ |
| 155 | 158 | protected function generateTimestamps($directory, $level = 0) |
@@ -166,8 +166,7 @@ |
||
| 166 | 166 | { |
| 167 | 167 | if(($this->_recursiveLevel < 0 || $level < $this->_recursiveLevel) && $this->validateDirectory($path)) |
| 168 | 168 | $timestamps = array_merge($this->generateTimestamps($path, $level + 1)); |
| 169 | - } |
|
| 170 | - elseif($this->validateFile($path)) |
|
| 169 | + } elseif($this->validateFile($path)) |
|
| 171 | 170 | $timestamps[$path] = filemtime($path); |
| 172 | 171 | } |
| 173 | 172 | closedir($dir); |
@@ -206,6 +206,8 @@ |
||
| 206 | 206 | * @param string the HTTP method for the request (GET,PUT,DELETE) |
| 207 | 207 | * @param string the the key to perform the action on (includes the directory) |
| 208 | 208 | * @param array the additional post data to send with the request |
| 209 | + * @param string $method |
|
| 210 | + * @param string $key |
|
| 209 | 211 | * @return \stdClass the response from the etcd instance |
| 210 | 212 | */ |
| 211 | 213 | protected function request($method, $key, $value = []) { |
@@ -119,6 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * @param boolean whether this list is read-only or not |
| 122 | + * @param boolean $value |
|
| 122 | 123 | */ |
| 123 | 124 | protected function setReadOnly($value) |
| 124 | 125 | { |
@@ -136,6 +137,7 @@ discard block |
||
| 136 | 137 | /** |
| 137 | 138 | * This must be called internally or when instantiated. |
| 138 | 139 | * @param numeric sets the default priority of inserted items without a specified priority |
| 140 | + * @param integer $value |
|
| 139 | 141 | */ |
| 140 | 142 | protected function setDefaultPriority($value) |
| 141 | 143 | { |
@@ -153,6 +155,7 @@ discard block |
||
| 153 | 155 | /** |
| 154 | 156 | * This must be called internally or when instantiated. |
| 155 | 157 | * @param integer The precision of numeric priorities. |
| 158 | + * @param integer $value |
|
| 156 | 159 | */ |
| 157 | 160 | protected function setPrecision($value) |
| 158 | 161 | { |
@@ -162,7 +165,7 @@ discard block |
||
| 162 | 165 | /** |
| 163 | 166 | * Returns an iterator for traversing the items in the map. |
| 164 | 167 | * This method is required by the interface \IteratorAggregate. |
| 165 | - * @return Iterator an iterator for traversing the items in the map. |
|
| 168 | + * @return \ArrayIterator an iterator for traversing the items in the map. |
|
| 166 | 169 | */ |
| 167 | 170 | public function getIterator() |
| 168 | 171 | { |
@@ -343,7 +346,7 @@ discard block |
||
| 343 | 346 | * @param mixed key |
| 344 | 347 | * @param mixed value |
| 345 | 348 | * @param numeric|null priority, default: null, filled in with default priority |
| 346 | - * @return numeric priority at which the pair was added |
|
| 349 | + * @return string priority at which the pair was added |
|
| 347 | 350 | * @throws TInvalidOperationException if the map is read-only |
| 348 | 351 | */ |
| 349 | 352 | public function add($key, $value, $priority = null) |
@@ -365,13 +365,11 @@ discard block |
||
| 365 | 365 | if(!isset($this->_d[$priority])) { |
| 366 | 366 | $this->_d[$priority] = [$key => $value]; |
| 367 | 367 | $this->_o = false; |
| 368 | - } |
|
| 369 | - else |
|
| 368 | + } else |
|
| 370 | 369 | $this->_d[$priority][$key] = $value; |
| 371 | 370 | $this->_c++; |
| 372 | 371 | $this->_fd = null; |
| 373 | - } |
|
| 374 | - else |
|
| 372 | + } else |
|
| 375 | 373 | throw new TInvalidOperationException('map_readonly', get_class($this)); |
| 376 | 374 | return $priority; |
| 377 | 375 | } |
@@ -413,8 +411,7 @@ discard block |
||
| 413 | 411 | return $value; |
| 414 | 412 | } |
| 415 | 413 | return null; |
| 416 | - } |
|
| 417 | - else |
|
| 414 | + } else |
|
| 418 | 415 | { |
| 419 | 416 | $priority = (string)round(TPropertyValue::ensureFloat($priority), $this->_p); |
| 420 | 417 | if(isset($this->_d[$priority]) && (isset($this->_d[$priority][$key]) || array_key_exists($key, $this->_d[$priority]))) |
@@ -428,12 +425,10 @@ discard block |
||
| 428 | 425 | } |
| 429 | 426 | $this->_fd = null; |
| 430 | 427 | return $value; |
| 431 | - } |
|
| 432 | - else |
|
| 428 | + } else |
|
| 433 | 429 | return null; |
| 434 | 430 | } |
| 435 | - } |
|
| 436 | - else |
|
| 431 | + } else |
|
| 437 | 432 | throw new TInvalidOperationException('map_readonly', get_class($this)); |
| 438 | 433 | } |
| 439 | 434 | |
@@ -526,15 +521,13 @@ discard block |
||
| 526 | 521 | $this->add($key, $value, $priority); |
| 527 | 522 | } |
| 528 | 523 | } |
| 529 | - } |
|
| 530 | - elseif(is_array($data) || $data instanceof \Traversable) |
|
| 524 | + } elseif(is_array($data) || $data instanceof \Traversable) |
|
| 531 | 525 | { |
| 532 | 526 | if($this->getCount() > 0) |
| 533 | 527 | $this->clear(); |
| 534 | 528 | foreach($data as $key => $value) |
| 535 | 529 | $this->add($key, $value); |
| 536 | - } |
|
| 537 | - elseif($data !== null) |
|
| 530 | + } elseif($data !== null) |
|
| 538 | 531 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 539 | 532 | } |
| 540 | 533 | |
@@ -554,13 +547,11 @@ discard block |
||
| 554 | 547 | foreach($data->itemsAtPriority($priority) as $key => $value) |
| 555 | 548 | $this->add($key, $value, $priority); |
| 556 | 549 | } |
| 557 | - } |
|
| 558 | - elseif(is_array($data) || $data instanceof \Traversable) |
|
| 550 | + } elseif(is_array($data) || $data instanceof \Traversable) |
|
| 559 | 551 | { |
| 560 | 552 | foreach($data as $key => $value) |
| 561 | 553 | $this->add($key, $value); |
| 562 | - } |
|
| 563 | - elseif($data !== null) |
|
| 554 | + } elseif($data !== null) |
|
| 564 | 555 | throw new TInvalidDataTypeException('map_data_not_iterable'); |
| 565 | 556 | } |
| 566 | 557 | |
@@ -36,6 +36,9 @@ discard block |
||
| 36 | 36 | private $_relation; //data from an entry of TActiveRecord::$RELATION |
| 37 | 37 | private $_fkeys; |
| 38 | 38 | |
| 39 | + /** |
|
| 40 | + * @param TActiveRecord $record |
|
| 41 | + */ |
|
| 39 | 42 | public function __construct($record, $property = null, $relation = null) |
| 40 | 43 | { |
| 41 | 44 | $this->_record = $record; |
@@ -169,6 +172,7 @@ discard block |
||
| 169 | 172 | * An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany, |
| 170 | 173 | * or TActiveRecordHasManyAssocation will be returned. |
| 171 | 174 | * @param TActiveRecordCriteria search criteria |
| 175 | + * @param \Prado\Data\DataGateway\TSqlCriteria $criteria |
|
| 172 | 176 | * @return TActiveRecordRelation record relationship handler instnace. |
| 173 | 177 | * @throws TActiveRecordException if property is not defined or missing. |
| 174 | 178 | */ |
@@ -197,7 +201,7 @@ discard block |
||
| 197 | 201 | } |
| 198 | 202 | |
| 199 | 203 | /** |
| 200 | - * @return TActiveRecordRelationCommand |
|
| 204 | + * @return boolean |
|
| 201 | 205 | */ |
| 202 | 206 | public function updateAssociatedRecords($updateBelongsTo = false) |
| 203 | 207 | { |
@@ -52,6 +52,10 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | + /** |
|
| 56 | + * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent |
|
| 57 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
| 58 | + */ |
|
| 55 | 59 | public function createScaffoldInput($parent, $item, $column, $record) |
| 56 | 60 | { |
| 57 | 61 | $this->_parent = $parent; |
@@ -68,6 +72,10 @@ discard block |
||
| 68 | 72 | $label->setForControl(self::DEFAULT_ID); |
| 69 | 73 | } |
| 70 | 74 | |
| 75 | + /** |
|
| 76 | + * @param \Prado\Data\ActiveRecord\Scaffold\TScaffoldEditView $parent |
|
| 77 | + * @param \Prado\Data\ActiveRecord\TActiveRecord $record |
|
| 78 | + */ |
|
| 71 | 79 | public function loadScaffoldInput($parent, $item, $column, $record) |
| 72 | 80 | { |
| 73 | 81 | $this->_parent = $parent; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | /** |
| 325 | 325 | * Gets the current Db connection, the connection object is obtained from |
| 326 | 326 | * the TActiveRecordManager if connection is currently null. |
| 327 | - * @return TDbConnection current db connection for this object. |
|
| 327 | + * @return \Prado\Data\TDbConnection current db connection for this object. |
|
| 328 | 328 | */ |
| 329 | 329 | public function getDbConnection() |
| 330 | 330 | { |
@@ -511,6 +511,7 @@ discard block |
||
| 511 | 511 | * Delete multiple records using a criteria. |
| 512 | 512 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 513 | 513 | * @param mixed parameter values. |
| 514 | + * @param TSqlCriteria $criteria |
|
| 514 | 515 | * @return int number of records deleted. |
| 515 | 516 | */ |
| 516 | 517 | public function deleteAll($criteria = null, $parameters = []) |
@@ -577,6 +578,7 @@ discard block |
||
| 577 | 578 | * |
| 578 | 579 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 579 | 580 | * @param mixed parameter values. |
| 581 | + * @param TSqlCriteria $criteria |
|
| 580 | 582 | * @return TActiveRecord matching record object. Null if no result is found. |
| 581 | 583 | */ |
| 582 | 584 | public function find($criteria, $parameters = []) |
@@ -593,6 +595,7 @@ discard block |
||
| 593 | 595 | * |
| 594 | 596 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 595 | 597 | * @param mixed parameter values. |
| 598 | + * @param TSqlCriteria $criteria |
|
| 596 | 599 | * @return array matching record objects. Empty array if no result is found. |
| 597 | 600 | */ |
| 598 | 601 | public function findAll($criteria = null, $parameters = []) |
@@ -706,6 +709,7 @@ discard block |
||
| 706 | 709 | * Find the number of records. |
| 707 | 710 | * @param string|TActiveRecordCriteria SQL condition or criteria object. |
| 708 | 711 | * @param mixed parameter values. |
| 712 | + * @param TActiveRecordCriteria $criteria |
|
| 709 | 713 | * @return int number of records. |
| 710 | 714 | */ |
| 711 | 715 | public function count($criteria = null, $parameters = []) |
@@ -721,6 +725,7 @@ discard block |
||
| 721 | 725 | * value equal to the $property value. |
| 722 | 726 | * @param string relationship/property name corresponding to keys in $RELATION array. |
| 723 | 727 | * @param array method call arguments. |
| 728 | + * @param string $name |
|
| 724 | 729 | * @return TActiveRecordRelation, null if the context or the handler doesn't exist |
| 725 | 730 | */ |
| 726 | 731 | protected function getRelationHandler($name, $args = []) |
@@ -945,6 +950,7 @@ discard block |
||
| 945 | 950 | * Raised before the record attempt to insert its data into the database. |
| 946 | 951 | * To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 947 | 952 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 953 | + * @param TActiveRecordChangeEventParameter $param |
|
| 948 | 954 | */ |
| 949 | 955 | public function onInsert($param) |
| 950 | 956 | { |
@@ -955,6 +961,7 @@ discard block |
||
| 955 | 961 | * Raised before the record attempt to delete its data from the database. |
| 956 | 962 | * To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 957 | 963 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 964 | + * @param TActiveRecordChangeEventParameter $param |
|
| 958 | 965 | */ |
| 959 | 966 | public function onDelete($param) |
| 960 | 967 | { |
@@ -965,6 +972,7 @@ discard block |
||
| 965 | 972 | * Raised before the record attempt to update its data in the database. |
| 966 | 973 | * To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false. |
| 967 | 974 | * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers |
| 975 | + * @param TActiveRecordChangeEventParameter $param |
|
| 968 | 976 | */ |
| 969 | 977 | public function onUpdate($param) |
| 970 | 978 | { |
@@ -1048,7 +1056,7 @@ discard block |
||
| 1048 | 1056 | |
| 1049 | 1057 | /** |
| 1050 | 1058 | * Return record data as JSON |
| 1051 | - * @return JSON |
|
| 1059 | + * @return string |
|
| 1052 | 1060 | * @since 3.2.4 |
| 1053 | 1061 | */ |
| 1054 | 1062 | public function toJSON(){ |
@@ -431,14 +431,12 @@ discard block |
||
| 431 | 431 | $this->_recordState = self::STATE_LOADED; |
| 432 | 432 | return true; |
| 433 | 433 | } |
| 434 | - } |
|
| 435 | - elseif($this->_recordState === self::STATE_LOADED) |
|
| 434 | + } elseif($this->_recordState === self::STATE_LOADED) |
|
| 436 | 435 | { |
| 437 | 436 | $this->onUpdate($param); |
| 438 | 437 | if($param->getIsValid() && $gateway->update($this)) |
| 439 | 438 | return true; |
| 440 | - } |
|
| 441 | - else |
|
| 439 | + } else |
|
| 442 | 440 | throw new TActiveRecordException('ar_save_invalid', get_class($this)); |
| 443 | 441 | |
| 444 | 442 | return false; |
@@ -461,8 +459,7 @@ discard block |
||
| 461 | 459 | $this->_recordState = self::STATE_DELETED; |
| 462 | 460 | return true; |
| 463 | 461 | } |
| 464 | - } |
|
| 465 | - else |
|
| 462 | + } else |
|
| 466 | 463 | throw new TActiveRecordException('ar_delete_invalid', get_class($this)); |
| 467 | 464 | |
| 468 | 465 | return false; |
@@ -729,8 +726,7 @@ discard block |
||
| 729 | 726 | { |
| 730 | 727 | $criteria = $this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1)); |
| 731 | 728 | return $context->getRelationHandler($criteria); |
| 732 | - } |
|
| 733 | - else |
|
| 729 | + } else |
|
| 734 | 730 | return null; |
| 735 | 731 | } |
| 736 | 732 | |
@@ -749,8 +745,7 @@ discard block |
||
| 749 | 745 | { |
| 750 | 746 | list($property, $relation) = $definition; |
| 751 | 747 | return new TActiveRecordRelationContext($this, $property, $relation); |
| 752 | - } |
|
| 753 | - else |
|
| 748 | + } else |
|
| 754 | 749 | return null; |
| 755 | 750 | } |
| 756 | 751 | |
@@ -833,8 +828,7 @@ discard block |
||
| 833 | 828 | { |
| 834 | 829 | $property = $method[4] === '_' ? substr($method, 5) : substr($method, 4); |
| 835 | 830 | return $this->getRelationHandler($property, $args); |
| 836 | - } |
|
| 837 | - elseif($findOne = strncasecmp($method, 'findby', 6) === 0) |
|
| 831 | + } elseif($findOne = strncasecmp($method, 'findby', 6) === 0) |
|
| 838 | 832 | $condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6); |
| 839 | 833 | elseif(strncasecmp($method, 'findallby', 9) === 0) |
| 840 | 834 | $condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9); |
@@ -900,8 +894,7 @@ discard block |
||
| 900 | 894 | { |
| 901 | 895 | $useArgs = !is_array($parameters) && is_array($args); |
| 902 | 896 | return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters); |
| 903 | - } |
|
| 904 | - elseif($criteria instanceof TSqlCriteria) |
|
| 897 | + } elseif($criteria instanceof TSqlCriteria) |
|
| 905 | 898 | return $criteria; |
| 906 | 899 | else |
| 907 | 900 | return new TActiveRecordCriteria(); |