@@ -170,26 +170,26 @@ discard block |
||
| 170 | 170 | $this->TDBMObject_state = $state; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Internal TDBM method, you should not use this. |
|
| 175 | - * Loads the db_row property of the object from the $row array. |
|
| 176 | - * Any row having a key starting with 'tdbm_reserved_col_' is ignored. |
|
| 177 | - * |
|
| 178 | - * @param array $row |
|
| 179 | - * @param array|null $colsArray A big optimization to avoid calling strpos to many times. This array should |
|
| 180 | - * contain as keys the list of interesting columns. If null, this list will be initialized. |
|
| 181 | - */ |
|
| 173 | + /** |
|
| 174 | + * Internal TDBM method, you should not use this. |
|
| 175 | + * Loads the db_row property of the object from the $row array. |
|
| 176 | + * Any row having a key starting with 'tdbm_reserved_col_' is ignored. |
|
| 177 | + * |
|
| 178 | + * @param array $row |
|
| 179 | + * @param array|null $colsArray A big optimization to avoid calling strpos to many times. This array should |
|
| 180 | + * contain as keys the list of interesting columns. If null, this list will be initialized. |
|
| 181 | + */ |
|
| 182 | 182 | public function loadFromRow($row, &$colsArray) { |
| 183 | - if ($colsArray === null) { |
|
| 184 | - foreach ($row as $key=>$value) { |
|
| 185 | - if (strpos($key, 'tdbm_reserved_col_')!==0) { |
|
| 186 | - $colsArray[$key] = true; |
|
| 187 | - } |
|
| 188 | - } |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - $this->db_row = array_intersect_key($row, $colsArray); |
|
| 192 | - $this->TDBMObject_state = "loaded"; |
|
| 183 | + if ($colsArray === null) { |
|
| 184 | + foreach ($row as $key=>$value) { |
|
| 185 | + if (strpos($key, 'tdbm_reserved_col_')!==0) { |
|
| 186 | + $colsArray[$key] = true; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + $this->db_row = array_intersect_key($row, $colsArray); |
|
| 192 | + $this->TDBMObject_state = "loaded"; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | /** |
| 327 | 327 | * Saves the current object by INSERTing or UPDAT(E)ing it in the database. |
| 328 | - * |
|
| 329 | - * This method must be called only from the DAOs. |
|
| 330 | - * @internal |
|
| 328 | + * |
|
| 329 | + * This method must be called only from the DAOs. |
|
| 330 | + * @internal |
|
| 331 | 331 | */ |
| 332 | 332 | public function save() { |
| 333 | 333 | if (!is_array($this->db_row)) { |
@@ -510,10 +510,10 @@ discard block |
||
| 510 | 510 | * |
| 511 | 511 | * @param string $func_name |
| 512 | 512 | * @param $values |
| 513 | - * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query. |
|
| 514 | - * @throws TDBMException |
|
| 513 | + * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query. |
|
| 514 | + * @throws TDBMException |
|
| 515 | 515 | */ |
| 516 | - public function __call($func_name, $values) { |
|
| 516 | + public function __call($func_name, $values) { |
|
| 517 | 517 | |
| 518 | 518 | if (strpos($func_name,"get_") === 0) { |
| 519 | 519 | $table = substr($func_name,4); |
@@ -548,48 +548,48 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | /** |
| 551 | - * Implements array behaviour for our object. |
|
| 552 | - * |
|
| 553 | - * @param string $offset |
|
| 554 | - * @param string $value |
|
| 555 | - */ |
|
| 551 | + * Implements array behaviour for our object. |
|
| 552 | + * |
|
| 553 | + * @param string $offset |
|
| 554 | + * @param string $value |
|
| 555 | + */ |
|
| 556 | 556 | public function offsetSet($offset, $value) { |
| 557 | 557 | $this->__set($offset, $value); |
| 558 | - } |
|
| 558 | + } |
|
| 559 | 559 | /** |
| 560 | 560 | * Implements array behaviour for our object. |
| 561 | 561 | * |
| 562 | 562 | * @param string $offset |
| 563 | - * @return bool |
|
| 563 | + * @return bool |
|
| 564 | 564 | */ |
| 565 | - public function offsetExists($offset) { |
|
| 566 | - $this->_dbLoadIfNotLoaded(); |
|
| 567 | - return isset($this->db_row[$offset]); |
|
| 568 | - } |
|
| 565 | + public function offsetExists($offset) { |
|
| 566 | + $this->_dbLoadIfNotLoaded(); |
|
| 567 | + return isset($this->db_row[$offset]); |
|
| 568 | + } |
|
| 569 | 569 | /** |
| 570 | 570 | * Implements array behaviour for our object. |
| 571 | 571 | * |
| 572 | 572 | * @param string $offset |
| 573 | 573 | */ |
| 574 | - public function offsetUnset($offset) { |
|
| 574 | + public function offsetUnset($offset) { |
|
| 575 | 575 | $this->__set($offset, null); |
| 576 | - } |
|
| 576 | + } |
|
| 577 | 577 | /** |
| 578 | 578 | * Implements array behaviour for our object. |
| 579 | 579 | * |
| 580 | 580 | * @param string $offset |
| 581 | - * @return mixed|null |
|
| 581 | + * @return mixed|null |
|
| 582 | 582 | */ |
| 583 | - public function offsetGet($offset) { |
|
| 584 | - return $this->__get($offset); |
|
| 585 | - } |
|
| 583 | + public function offsetGet($offset) { |
|
| 584 | + return $this->__get($offset); |
|
| 585 | + } |
|
| 586 | 586 | |
| 587 | 587 | private $_validIterator = false; |
| 588 | 588 | /** |
| 589 | 589 | * Implements iterator behaviour for our object (so we can each column). |
| 590 | 590 | */ |
| 591 | 591 | public function rewind() { |
| 592 | - $this->_dbLoadIfNotLoaded(); |
|
| 592 | + $this->_dbLoadIfNotLoaded(); |
|
| 593 | 593 | if (count($this->db_row)>0) { |
| 594 | 594 | $this->_validIterator = true; |
| 595 | 595 | } else { |
@@ -677,21 +677,21 @@ discard block |
||
| 677 | 677 | return $sql_where; |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | - /** |
|
| 681 | - * Override the native php clone function for TDBMObjects |
|
| 682 | - */ |
|
| 683 | - public function __clone(){ |
|
| 684 | - $this->_dbLoadIfNotLoaded(); |
|
| 685 | - //First lets set the status to new (to enter the save function) |
|
| 686 | - $this->TDBMObject_state = "new"; |
|
| 687 | - |
|
| 688 | - // Add the current TDBMObject to the save object list |
|
| 689 | - $this->tdbmService->_addToToSaveObjectList($this); |
|
| 690 | - |
|
| 691 | - //Now unset the PK from the row |
|
| 692 | - $pk_array = $this->getPrimaryKey(); |
|
| 693 | - foreach ($pk_array as $pk) { |
|
| 694 | - $this->db_row[$pk] = null; |
|
| 695 | - } |
|
| 696 | - } |
|
| 680 | + /** |
|
| 681 | + * Override the native php clone function for TDBMObjects |
|
| 682 | + */ |
|
| 683 | + public function __clone(){ |
|
| 684 | + $this->_dbLoadIfNotLoaded(); |
|
| 685 | + //First lets set the status to new (to enter the save function) |
|
| 686 | + $this->TDBMObject_state = "new"; |
|
| 687 | + |
|
| 688 | + // Add the current TDBMObject to the save object list |
|
| 689 | + $this->tdbmService->_addToToSaveObjectList($this); |
|
| 690 | + |
|
| 691 | + //Now unset the PK from the row |
|
| 692 | + $pk_array = $this->getPrimaryKey(); |
|
| 693 | + foreach ($pk_array as $pk) { |
|
| 694 | + $this->db_row[$pk] = null; |
|
| 695 | + } |
|
| 696 | + } |
|
| 697 | 697 | } |
| 698 | 698 | \ No newline at end of file |