@@ -133,14 +133,14 @@ |
||
133 | 133 | $work_table = explode("'", $work_str); |
134 | 134 | |
135 | 135 | if (count($work_table) == 0) |
136 | - return ''; |
|
136 | + return ''; |
|
137 | 137 | |
138 | 138 | // if we start with a ', let's remove the first text |
139 | 139 | if (strstr($work_str,"'") === 0) |
140 | - array_shift($work_table); |
|
140 | + array_shift($work_table); |
|
141 | 141 | |
142 | 142 | if (count($work_table) == 0) |
143 | - return ''; |
|
143 | + return ''; |
|
144 | 144 | |
145 | 145 | // Now, let's take only the stuff outside the quotes. |
146 | 146 | $work_str2 = ''; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | private function getAllPossiblePaths() { |
48 | - return AmbiguityException::getAllPossiblePathsRec($this->paths); |
|
48 | + return AmbiguityException::getAllPossiblePathsRec($this->paths); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | private static function getAllPossiblePathsRec($sub_table_paths) |
@@ -65,9 +65,9 @@ |
||
65 | 65 | * @param string $func_name |
66 | 66 | * @param $values |
67 | 67 | * @return array|void |
68 | - * @throws TDBMException |
|
68 | + * @throws TDBMException |
|
69 | 69 | */ |
70 | - public function __call($func_name, $values) { |
|
70 | + public function __call($func_name, $values) { |
|
71 | 71 | |
72 | 72 | if (strpos($func_name,"getarray_") === 0) { |
73 | 73 | $column = substr($func_name, 9); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($this->daoNamespace == null && $this->beanNamespace == null) { |
68 | - $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
68 | + $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
69 | 69 | |
70 | 70 | $autoloadNamespaces = $classNameMapper->getManagedNamespaces(); |
71 | - if ($autoloadNamespaces) { |
|
71 | + if ($autoloadNamespaces) { |
|
72 | 72 | $this->autoloadDetected = true; |
73 | 73 | $rootNamespace = $autoloadNamespaces[0]; |
74 | 74 | $this->daoNamespace = $rootNamespace."Dao"; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $tdbmService = new InstanceProxy($name); |
152 | 152 | /* @var $tdbmService TDBMService */ |
153 | - $tables = $tdbmService->generateAllDaosAndBeans($daofactoryclassname, $daonamespace, $beannamespace, $keepSupport, $storeInUtc, $castDatesToDateTime); |
|
153 | + $tables = $tdbmService->generateAllDaosAndBeans($daofactoryclassname, $daonamespace, $beannamespace, $keepSupport, $storeInUtc, $castDatesToDateTime); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | $moufManager->declareComponent($daofactoryinstancename, $daonamespace."\\".$daofactoryclassname, false, MoufManager::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS); |
@@ -111,12 +111,12 @@ discard block |
||
111 | 111 | $this->beanNamespace = $this->moufManager->getVariable("tdbmDefaultBeanNamespace_tdbmService"); |
112 | 112 | |
113 | 113 | if ($this->daoNamespace == null && $this->beanNamespace == null) { |
114 | - $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
114 | + $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
115 | 115 | |
116 | - $autoloadNamespaces = $classNameMapper->getManagedNamespaces(); |
|
116 | + $autoloadNamespaces = $classNameMapper->getManagedNamespaces(); |
|
117 | 117 | if ($autoloadNamespaces) { |
118 | 118 | $this->autoloadDetected = true; |
119 | - $rootNamespace = $autoloadNamespaces[0]; |
|
119 | + $rootNamespace = $autoloadNamespaces[0]; |
|
120 | 120 | $this->daoNamespace = $rootNamespace."Dao"; |
121 | 121 | $this->beanNamespace = $rootNamespace."Dao\\Bean"; |
122 | 122 | } else { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string $selfedit |
147 | 147 | * @throws \Mouf\MoufException |
148 | 148 | */ |
149 | - public function generate($daonamespace, $beannamespace, $keepSupport = 0, $storeInUtc = 0, $castDatesToDateTime = 1, $selfedit="false") { |
|
149 | + public function generate($daonamespace, $beannamespace, $keepSupport = 0, $storeInUtc = 0, $castDatesToDateTime = 1, $selfedit="false") { |
|
150 | 150 | $this->selfedit = $selfedit; |
151 | 151 | |
152 | 152 | if ($selfedit == "true") { |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param string $tableName |
100 | 100 | * @param string $columnName |
101 | - * @param string $value1 |
|
102 | - * @param string $value2 |
|
101 | + * @param string $value1 |
|
102 | + * @param string $value2 |
|
103 | 103 | */ |
104 | 104 | public function __construct($tableName=null, $columnName=null, $value1=null, $value2=null) { |
105 | 105 | $this->tableName = $tableName; |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @param ConnectionInterface $dbConnection |
115 | 115 | * @return string |
116 | - * @throws \Mouf\Database\TDBM\TDBMException |
|
116 | + * @throws \Mouf\Database\TDBM\TDBMException |
|
117 | 117 | */ |
118 | - public function toSql(ConnectionInterface $dbConnection) { |
|
118 | + public function toSql(ConnectionInterface $dbConnection) { |
|
119 | 119 | if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
120 | 120 | return ""; |
121 | 121 | } |
@@ -9,14 +9,14 @@ |
||
9 | 9 | */ |
10 | 10 | class FilterUtils |
11 | 11 | { |
12 | - /** |
|
13 | - * @param string|null|DateTimeInterface $value |
|
14 | - */ |
|
15 | - public static function valueToSql($value, ConnectionInterface $dbConnection) { |
|
16 | - if ($value instanceof DateTimeInterface) { |
|
17 | - return "'".$value->format('Y-m-d H:i:s')."'"; |
|
18 | - } else { |
|
19 | - return $dbConnection->quoteSmart($value); |
|
20 | - } |
|
21 | - } |
|
12 | + /** |
|
13 | + * @param string|null|DateTimeInterface $value |
|
14 | + */ |
|
15 | + public static function valueToSql($value, ConnectionInterface $dbConnection) { |
|
16 | + if ($value instanceof DateTimeInterface) { |
|
17 | + return "'".$value->format('Y-m-d H:i:s')."'"; |
|
18 | + } else { |
|
19 | + return $dbConnection->quoteSmart($value); |
|
20 | + } |
|
21 | + } |
|
22 | 22 | } |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param ConnectionInterface $dbConnection |
70 | 70 | * @return string |
71 | - * @throws TDBMException |
|
71 | + * @throws TDBMException |
|
72 | 72 | */ |
73 | - public function toSql(ConnectionInterface $dbConnection) { |
|
73 | + public function toSql(ConnectionInterface $dbConnection) { |
|
74 | 74 | if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
75 | 75 | return ""; |
76 | 76 | } |
@@ -102,22 +102,22 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array<string> |
104 | 104 | */ |
105 | - public function getUsedTables() { |
|
106 | - if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
|
107 | - return array(); |
|
108 | - } |
|
109 | - |
|
110 | - $tables = array(); |
|
111 | - foreach ($this->filters as $filter) { |
|
112 | - |
|
113 | - if (!$filter instanceof FilterInterface) { |
|
114 | - throw new TDBMException("Error in OrFilter: One of the parameters is not a filter."); |
|
115 | - } |
|
116 | - |
|
117 | - $tables = array_merge($tables,$filter->getUsedTables()); |
|
118 | - } |
|
119 | - // Remove tables in double. |
|
120 | - $tables = array_flip(array_flip($tables)); |
|
121 | - return $tables; |
|
122 | - } |
|
105 | + public function getUsedTables() { |
|
106 | + if ($this->enableCondition != null && !$this->enableCondition->isOk()) { |
|
107 | + return array(); |
|
108 | + } |
|
109 | + |
|
110 | + $tables = array(); |
|
111 | + foreach ($this->filters as $filter) { |
|
112 | + |
|
113 | + if (!$filter instanceof FilterInterface) { |
|
114 | + throw new TDBMException("Error in OrFilter: One of the parameters is not a filter."); |
|
115 | + } |
|
116 | + |
|
117 | + $tables = array_merge($tables,$filter->getUsedTables()); |
|
118 | + } |
|
119 | + // Remove tables in double. |
|
120 | + $tables = array_flip(array_flip($tables)); |
|
121 | + return $tables; |
|
122 | + } |
|
123 | 123 | } |
@@ -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 | /** |
@@ -507,10 +507,10 @@ discard block |
||
507 | 507 | * |
508 | 508 | * @param string $func_name |
509 | 509 | * @param $values |
510 | - * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query. |
|
511 | - * @throws TDBMException |
|
510 | + * @return TDBMObjectArray A TDBMObjectArray containing the resulting objects of the query. |
|
511 | + * @throws TDBMException |
|
512 | 512 | */ |
513 | - public function __call($func_name, $values) { |
|
513 | + public function __call($func_name, $values) { |
|
514 | 514 | |
515 | 515 | if (strpos($func_name,"get_") === 0) { |
516 | 516 | $table = substr($func_name,4); |
@@ -545,48 +545,48 @@ discard block |
||
545 | 545 | } |
546 | 546 | |
547 | 547 | /** |
548 | - * Implements array behaviour for our object. |
|
549 | - * |
|
550 | - * @param string $offset |
|
551 | - * @param string $value |
|
552 | - */ |
|
548 | + * Implements array behaviour for our object. |
|
549 | + * |
|
550 | + * @param string $offset |
|
551 | + * @param string $value |
|
552 | + */ |
|
553 | 553 | public function offsetSet($offset, $value) { |
554 | 554 | $this->__set($offset, $value); |
555 | - } |
|
555 | + } |
|
556 | 556 | /** |
557 | 557 | * Implements array behaviour for our object. |
558 | 558 | * |
559 | 559 | * @param string $offset |
560 | - * @return bool |
|
560 | + * @return bool |
|
561 | 561 | */ |
562 | - public function offsetExists($offset) { |
|
563 | - $this->_dbLoadIfNotLoaded(); |
|
564 | - return isset($this->db_row[$offset]); |
|
565 | - } |
|
562 | + public function offsetExists($offset) { |
|
563 | + $this->_dbLoadIfNotLoaded(); |
|
564 | + return isset($this->db_row[$offset]); |
|
565 | + } |
|
566 | 566 | /** |
567 | 567 | * Implements array behaviour for our object. |
568 | 568 | * |
569 | 569 | * @param string $offset |
570 | 570 | */ |
571 | - public function offsetUnset($offset) { |
|
571 | + public function offsetUnset($offset) { |
|
572 | 572 | $this->__set($offset, null); |
573 | - } |
|
573 | + } |
|
574 | 574 | /** |
575 | 575 | * Implements array behaviour for our object. |
576 | 576 | * |
577 | 577 | * @param string $offset |
578 | - * @return mixed|null |
|
578 | + * @return mixed|null |
|
579 | 579 | */ |
580 | - public function offsetGet($offset) { |
|
581 | - return $this->__get($offset); |
|
582 | - } |
|
580 | + public function offsetGet($offset) { |
|
581 | + return $this->__get($offset); |
|
582 | + } |
|
583 | 583 | |
584 | 584 | private $_validIterator = false; |
585 | 585 | /** |
586 | 586 | * Implements iterator behaviour for our object (so we can each column). |
587 | 587 | */ |
588 | 588 | public function rewind() { |
589 | - $this->_dbLoadIfNotLoaded(); |
|
589 | + $this->_dbLoadIfNotLoaded(); |
|
590 | 590 | if (count($this->db_row)>0) { |
591 | 591 | $this->_validIterator = true; |
592 | 592 | } else { |
@@ -674,21 +674,21 @@ discard block |
||
674 | 674 | return $sql_where; |
675 | 675 | } |
676 | 676 | |
677 | - /** |
|
678 | - * Override the native php clone function for TDBMObjects |
|
679 | - */ |
|
680 | - public function __clone(){ |
|
681 | - $this->_dbLoadIfNotLoaded(); |
|
682 | - //First lets set the status to new (to enter the save function) |
|
683 | - $this->TDBMObject_state = "new"; |
|
684 | - |
|
685 | - // Add the current TDBMObject to the save object list |
|
686 | - $this->tdbmService->_addToToSaveObjectList($this); |
|
687 | - |
|
688 | - //Now unset the PK from the row |
|
689 | - $pk_array = $this->getPrimaryKey(); |
|
690 | - foreach ($pk_array as $pk) { |
|
691 | - $this->db_row[$pk] = null; |
|
692 | - } |
|
693 | - } |
|
677 | + /** |
|
678 | + * Override the native php clone function for TDBMObjects |
|
679 | + */ |
|
680 | + public function __clone(){ |
|
681 | + $this->_dbLoadIfNotLoaded(); |
|
682 | + //First lets set the status to new (to enter the save function) |
|
683 | + $this->TDBMObject_state = "new"; |
|
684 | + |
|
685 | + // Add the current TDBMObject to the save object list |
|
686 | + $this->tdbmService->_addToToSaveObjectList($this); |
|
687 | + |
|
688 | + //Now unset the PK from the row |
|
689 | + $pk_array = $this->getPrimaryKey(); |
|
690 | + foreach ($pk_array as $pk) { |
|
691 | + $this->db_row[$pk] = null; |
|
692 | + } |
|
693 | + } |
|
694 | 694 | } |
695 | 695 | \ No newline at end of file |