@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | class Model { |
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * This model's default database table. |
35 | 35 | * @var string the name of table |
36 | 36 | */ |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | if ($db !== null) { |
174 | 174 | $this->setDb($db); |
175 | 175 | } else { |
176 | - /** |
|
177 | - * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | - * to prevent duplication |
|
179 | - */ |
|
180 | - $obj = & get_instance(); |
|
181 | - $this->setDb(clone $obj->database); |
|
176 | + /** |
|
177 | + * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | + * to prevent duplication |
|
179 | + */ |
|
180 | + $obj = & get_instance(); |
|
181 | + $this->setDb(clone $obj->database); |
|
182 | 182 | } |
183 | 183 | array_unshift($this->beforeCreateCallbacks, 'removeProtectedTableColumns'); |
184 | 184 | array_unshift($this->beforeUpdateCallbacks, 'removeProtectedTableColumns'); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * Only get deleted rows on the next call |
593 | 593 | * |
594 | 594 | * @return object the current instance |
595 | - */ |
|
595 | + */ |
|
596 | 596 | public function onlyRecordDeleted() { |
597 | 597 | $this->returnOnlyRecordDeleted = true; |
598 | 598 | return $this; |
@@ -686,8 +686,8 @@ discard block |
||
686 | 686 | * @return array the data after add field for updated time |
687 | 687 | */ |
688 | 688 | protected function updatedAt($row) { |
689 | - $row['updated_at'] = date('Y-m-d H:i:s'); |
|
690 | - return $row; |
|
689 | + $row['updated_at'] = date('Y-m-d H:i:s'); |
|
690 | + return $row; |
|
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | */ |
733 | 733 | protected function removeProtectedTableColumns($row) { |
734 | 734 | foreach ($this->protectedTableColumns as $attr) { |
735 | - if (isset($row[$attr])) { |
|
735 | + if (isset($row[$attr])) { |
|
736 | 736 | unset($row[$attr]); |
737 | 737 | } |
738 | 738 | } |
@@ -787,23 +787,23 @@ discard block |
||
787 | 787 | return false; |
788 | 788 | } |
789 | 789 | |
790 | - /** |
|
791 | - * Get the record return type array or object |
|
792 | - * |
|
793 | - * @return string|boolean |
|
794 | - */ |
|
790 | + /** |
|
791 | + * Get the record return type array or object |
|
792 | + * |
|
793 | + * @return string|boolean |
|
794 | + */ |
|
795 | 795 | protected function getReturnType(){ |
796 | 796 | $type = false; |
797 | 797 | if ($this->temporaryReturnRecordType == 'array') { |
798 | - $type = 'array'; |
|
798 | + $type = 'array'; |
|
799 | 799 | } |
800 | 800 | return $type; |
801 | 801 | } |
802 | 802 | |
803 | - /** |
|
804 | - * Check if soft delete is enable setting the condition |
|
805 | - * @return object the current instance |
|
806 | - */ |
|
803 | + /** |
|
804 | + * Check if soft delete is enable setting the condition |
|
805 | + * @return object the current instance |
|
806 | + */ |
|
807 | 807 | protected function checkForSoftDelete(){ |
808 | 808 | if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) { |
809 | 809 | $this->getQueryBuilder()->where( |
@@ -814,16 +814,16 @@ discard block |
||
814 | 814 | return $this; |
815 | 815 | } |
816 | 816 | |
817 | - /** |
|
818 | - * Relate for "manyToOne" and "oneToMany" |
|
819 | - * |
|
820 | - * @param string $relationship the name of relation |
|
821 | - * @param string|array $options the model and primary key values |
|
822 | - * @param object|array $row the row to update |
|
823 | - * @param string $type the type can be "manyToOne", "oneToMany" |
|
824 | - * |
|
825 | - * @return array|object the final row values |
|
826 | - */ |
|
817 | + /** |
|
818 | + * Relate for "manyToOne" and "oneToMany" |
|
819 | + * |
|
820 | + * @param string $relationship the name of relation |
|
821 | + * @param string|array $options the model and primary key values |
|
822 | + * @param object|array $row the row to update |
|
823 | + * @param string $type the type can be "manyToOne", "oneToMany" |
|
824 | + * |
|
825 | + * @return array|object the final row values |
|
826 | + */ |
|
827 | 827 | protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){ |
828 | 828 | if (in_array($relationship, $this->withs)) { |
829 | 829 | get_instance()->loader->model($options['model'], $relationship . '_model'); |