@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | class TDBMObjectArray extends \ArrayObject implements \JsonSerializable { |
| 29 | 29 | public function __get($var) { |
| 30 | 30 | $cnt = count($this); |
| 31 | - if ($cnt==1) |
|
| 31 | + if ($cnt == 1) |
|
| 32 | 32 | { |
| 33 | 33 | return $this[0]->__get($var); |
| 34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function __set($var, $value) { |
| 46 | 46 | $cnt = count($this); |
| 47 | - if ($cnt==1) |
|
| 47 | + if ($cnt == 1) |
|
| 48 | 48 | { |
| 49 | 49 | return $this[0]->__set($var, $value); |
| 50 | 50 | } |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function __call($func_name, $values) { |
| 71 | 71 | |
| 72 | - if (strpos($func_name,"getarray_") === 0) { |
|
| 72 | + if (strpos($func_name, "getarray_") === 0) { |
|
| 73 | 73 | $column = substr($func_name, 9); |
| 74 | 74 | return $this->getarray($column); |
| 75 | - } elseif (strpos($func_name,"setarray_") === 0) { |
|
| 75 | + } elseif (strpos($func_name, "setarray_") === 0) { |
|
| 76 | 76 | $column = substr($func_name, 9); |
| 77 | 77 | return $this->setarray($column, $values[0]); |
| 78 | - } elseif (count($this)==1) { |
|
| 78 | + } elseif (count($this) == 1) { |
|
| 79 | 79 | $this[0]->__call($func_name, $values); |
| 80 | 80 | } |
| 81 | 81 | else |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function jsonSerialize(){ |
|
| 102 | + public function jsonSerialize() { |
|
| 103 | 103 | return (array) $this; |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @Action |
| 43 | 43 | * //@Admin |
| 44 | 44 | */ |
| 45 | - public function defaultAction($name, $selfedit="false") { |
|
| 45 | + public function defaultAction($name, $selfedit = "false") { |
|
| 46 | 46 | $this->initController($name, $selfedit); |
| 47 | 47 | |
| 48 | 48 | // Fill variables |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * @param string $name |
| 94 | 94 | * @param bool $selfedit |
| 95 | 95 | */ |
| 96 | - public function generate($name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $keepSupport = 0, $storeInUtc = 0, $castDatesToDateTime = 0, $selfedit="false") { |
|
| 96 | + public function generate($name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $keepSupport = 0, $storeInUtc = 0, $castDatesToDateTime = 0, $selfedit = "false") { |
|
| 97 | 97 | $this->initController($name, $selfedit); |
| 98 | 98 | |
| 99 | 99 | self::generateDaos($this->moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit, $keepSupport, $storeInUtc, $castDatesToDateTime); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @param bool $castDatesToDateTime |
| 117 | 117 | * @throws \Mouf\MoufException |
| 118 | 118 | */ |
| 119 | - public static function generateDaos(MoufManager $moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit="false", $keepSupport = null, $storeInUtc = null, $castDatesToDateTime = null) { |
|
| 119 | + public static function generateDaos(MoufManager $moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit = "false", $keepSupport = null, $storeInUtc = null, $castDatesToDateTime = null) { |
|
| 120 | 120 | $moufManager->setVariable("tdbmDefaultDaoNamespace_".$name, $daonamespace); |
| 121 | 121 | $moufManager->setVariable("tdbmDefaultBeanNamespace_".$name, $beannamespace); |
| 122 | 122 | $moufManager->setVariable("tdbmDefaultDaoFactoryName_".$name, $daofactoryclassname); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $moufManager->bindComponentViaSetter($instanceName, "setTdbmService", $name); |
| 168 | 168 | $moufManager->bindComponentViaSetter($daofactoryinstancename, "set".$daoName, $instanceName); |
| 169 | 169 | |
| 170 | - $tableToBeanMap[$table] = $beannamespace . "\\" . TDBMDaoGenerator::getBeanNameFromTableName($table); |
|
| 170 | + $tableToBeanMap[$table] = $beannamespace."\\".TDBMDaoGenerator::getBeanNameFromTableName($table); |
|
| 171 | 171 | } |
| 172 | 172 | $tdbmServiceDescriptor = $moufManager->getInstanceDescriptor($name); |
| 173 | 173 | $tdbmServiceDescriptor->getSetterProperty("setTableToBeanMap")->setValue($tableToBeanMap); |
@@ -146,7 +146,7 @@ |
||
| 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") { |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | public static $box_height = 30; |
| 34 | 34 | public static $interspace_width = 10; |
| 35 | 35 | public static $interspace_height = 50; |
| 36 | - public static $text_height=13; |
|
| 37 | - public static $border =2; |
|
| 36 | + public static $text_height = 13; |
|
| 37 | + public static $border = 2; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | private $parent_node; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public $width; |
| 48 | 48 | |
| 49 | - public function __construct($table_name, $parent_node=null, $link_type=null, $keyParent=null, $keyNode=null) { |
|
| 49 | + public function __construct($table_name, $parent_node = null, $link_type = null, $keyParent = null, $keyNode = null) { |
|
| 50 | 50 | $this->table_name = $table_name; |
| 51 | 51 | if ($parent_node !== null) { |
| 52 | 52 | $this->parent_node = $parent_node; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function computeWidth() { |
| 86 | - if (!is_array($this->children) || count($this->children)==0) { |
|
| 86 | + if (!is_array($this->children) || count($this->children) == 0) { |
|
| 87 | 87 | $this->width = 1; |
| 88 | 88 | return 1; |
| 89 | 89 | } else { |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function computeDepth($my_depth) { |
| 100 | - if (!is_array($this->children) || count($this->children)==0) { |
|
| 100 | + if (!is_array($this->children) || count($this->children) == 0) { |
|
| 101 | 101 | return $my_depth+1; |
| 102 | 102 | } else { |
| 103 | 103 | $max = 0; |
| 104 | 104 | foreach ($this->children as $child) { |
| 105 | - $depth = $my_depth + $child->computeDepth($my_depth); |
|
| 106 | - if ($depth > $max) { |
|
| 105 | + $depth = $my_depth+$child->computeDepth($my_depth); |
|
| 106 | + if ($depth>$max) { |
|
| 107 | 107 | $max = $depth; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -113,23 +113,23 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function draw($x, $y, $left_px, $top_px) { |
| 115 | 115 | |
| 116 | - $mybox_width_px = $this->width*DisplayNode::$box_width + ($this->width-1)*DisplayNode::$interspace_width; |
|
| 117 | - $my_x_px = $left_px + DisplayNode::$left_start + $x*(DisplayNode::$box_width + DisplayNode::$interspace_width); |
|
| 118 | - $my_y_px = $top_px + DisplayNode::$top_start + $y*(DisplayNode::$box_height + DisplayNode::$interspace_height); |
|
| 116 | + $mybox_width_px = $this->width*DisplayNode::$box_width+($this->width-1)*DisplayNode::$interspace_width; |
|
| 117 | + $my_x_px = $left_px+DisplayNode::$left_start+$x*(DisplayNode::$box_width+DisplayNode::$interspace_width); |
|
| 118 | + $my_y_px = $top_px+DisplayNode::$top_start+$y*(DisplayNode::$box_height+DisplayNode::$interspace_height); |
|
| 119 | 119 | |
| 120 | 120 | // White background first |
| 121 | 121 | $str = "<div style='position:absolute; left:".$my_x_px."px; top:".$my_y_px."px; width:".$mybox_width_px."px; height:".DisplayNode::$box_height."; background-color:gray; color: white; text-align:center; border:".DisplayNode::$border."px solid black'>\n<b>".$this->table_name."</b></div>"; |
| 122 | 122 | |
| 123 | 123 | if ($this->keyParent != null) { |
| 124 | - $my_x_px_line = $my_x_px + DisplayNode::$box_width/2; |
|
| 125 | - $my_y_px_line = $my_y_px - DisplayNode::$interspace_height; |
|
| 124 | + $my_x_px_line = $my_x_px+DisplayNode::$box_width/2; |
|
| 125 | + $my_y_px_line = $my_y_px-DisplayNode::$interspace_height; |
|
| 126 | 126 | $str .= "<div style='position:absolute; left:".$my_x_px_line."px; top:".($my_y_px_line+DisplayNode::$border)."px; width:2px; height:".(DisplayNode::$interspace_height-DisplayNode::$border)."; background-color:black; '></div>\n"; |
| 127 | 127 | |
| 128 | - $top_key = ($this->link_type=='1*')?'* fk:':'1 pk:'; |
|
| 128 | + $top_key = ($this->link_type == '1*') ? '* fk:' : '1 pk:'; |
|
| 129 | 129 | $top_key .= '<i>'.$this->keyParent.'</i>'; |
| 130 | 130 | |
| 131 | 131 | |
| 132 | - $bottom_key = ($this->link_type=='*1')?'* fk:':'1 pk:'; |
|
| 132 | + $bottom_key = ($this->link_type == '*1') ? '* fk:' : '1 pk:'; |
|
| 133 | 133 | $bottom_key .= '<i>'.$this->keyParent.'</i>'; |
| 134 | 134 | |
| 135 | 135 | $str .= "<div style='position:absolute; left:".($my_x_px_line+2)."px; top:".($my_y_px_line+DisplayNode::$border*2)."px; background-color:#EEEEEE; font-size: 10px'>$top_key</div>\n"; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @param string $table_name |
| 110 | 110 | * @param mixed $id |
| 111 | 111 | */ |
| 112 | - public function __construct(TDBMService $tdbmService, $table_name, $id=false) { |
|
| 112 | + public function __construct(TDBMService $tdbmService, $table_name, $id = false) { |
|
| 113 | 113 | $this->tdbmService = $tdbmService; |
| 114 | 114 | $this->db_connection = $this->tdbmService->getConnection(); |
| 115 | 115 | $this->db_table_name = $table_name; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * $TDBMObject_state = "loaded" when the object is cached in memory. |
| 155 | 155 | * @return string |
| 156 | 156 | */ |
| 157 | - public function getTDBMObjectState(){ |
|
| 157 | + public function getTDBMObjectState() { |
|
| 158 | 158 | return $this->TDBMObject_state; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * $TDBMObject_state = "loaded" when the object is cached in memory. |
| 167 | 167 | * @param string $state |
| 168 | 168 | */ |
| 169 | - public function setTDBMObjectState($state){ |
|
| 169 | + public function setTDBMObjectState($state) { |
|
| 170 | 170 | $this->TDBMObject_state = $state; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | public function loadFromRow($row, &$colsArray) { |
| 183 | 183 | if ($colsArray === null) { |
| 184 | 184 | foreach ($row as $key=>$value) { |
| 185 | - if (strpos($key, 'tdbm_reserved_col_')!==0) { |
|
| 185 | + if (strpos($key, 'tdbm_reserved_col_') !== 0) { |
|
| 186 | 186 | $colsArray[$key] = true; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $result = $this->db_connection->query($sql); |
| 221 | 221 | |
| 222 | 222 | |
| 223 | - if ($result->rowCount()==0) |
|
| 223 | + if ($result->rowCount() == 0) |
|
| 224 | 224 | { |
| 225 | 225 | throw new TDBMException("Could not retrieve object from table \"$this->db_table_name\" with ID \"".$this->TDBMObject_id."\"."); |
| 226 | 226 | } |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | $result->closeCursor(); |
| 231 | 231 | |
| 232 | 232 | $this->db_row = array(); |
| 233 | - foreach ($fullCaseRow[0] as $key=>$value) { |
|
| 234 | - $this->db_row[$this->db_connection->toStandardCaseColumn($key)]=$value; |
|
| 233 | + foreach ($fullCaseRow[0] as $key=>$value) { |
|
| 234 | + $this->db_row[$this->db_connection->toStandardCaseColumn($key)] = $value; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | $this->TDBMObject_state = "loaded"; |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | // Let's try to be accurate in error reporting. The checkColumnExist returns an array of closest matches. |
| 264 | 264 | $result_array = $column_exist; |
| 265 | 265 | |
| 266 | - if (count($result_array)==1) |
|
| 266 | + if (count($result_array) == 1) |
|
| 267 | 267 | $str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant this column: '".$result_array[0]."'"; |
| 268 | 268 | else |
| 269 | - $str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant one of those columns: '".implode("', '",$result_array)."'"; |
|
| 269 | + $str = "Could not find column \"$var\" in table \"$this->db_table_name\". Maybe you meant one of those columns: '".implode("', '", $result_array)."'"; |
|
| 270 | 270 | |
| 271 | 271 | |
| 272 | 272 | throw new TDBMException($str); |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | $pk_array = $this->getPrimaryKey(); |
| 340 | 340 | |
| 341 | 341 | foreach ($pk_array as $pk) { |
| 342 | - if (isset($this->db_row[$pk]) && $this->db_row[$pk]!==null) { |
|
| 343 | - $pk_set=true; |
|
| 342 | + if (isset($this->db_row[$pk]) && $this->db_row[$pk] !== null) { |
|
| 343 | + $pk_set = true; |
|
| 344 | 344 | } |
| 345 | 345 | } |
| 346 | 346 | // if there are many columns for the PK, and none is set, we have no way to find the object back! |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | if (!$first) |
| 364 | 364 | $sql .= ','; |
| 365 | 365 | $sql .= $this->db_connection->quoteSmart($value); |
| 366 | - $first=false; |
|
| 366 | + $first = false; |
|
| 367 | 367 | } |
| 368 | 368 | $sql .= ')'; |
| 369 | 369 | |
@@ -391,12 +391,12 @@ discard block |
||
| 391 | 391 | |
| 392 | 392 | // If there is only one column for the primary key, and if it has not been filled, let's find it. |
| 393 | 393 | // We assume this is the biggest ID in the database |
| 394 | - if (count($pk_array)==1 && !$pk_set) { |
|
| 394 | + if (count($pk_array) == 1 && !$pk_set) { |
|
| 395 | 395 | // FIXME: for PostgreSQL or MSSQL, the getInsertId call is not thread safe |
| 396 | 396 | // We should start a transaction before the insert |
| 397 | - $this->TDBMObject_id = $this->db_connection->getInsertId($this->db_table_name,$pk_array[0]); |
|
| 397 | + $this->TDBMObject_id = $this->db_connection->getInsertId($this->db_table_name, $pk_array[0]); |
|
| 398 | 398 | $this->db_row[$pk_array[0]] = $this->TDBMObject_id; |
| 399 | - } elseif (count($pk_array)==1 && $pk_set) { |
|
| 399 | + } elseif (count($pk_array) == 1 && $pk_set) { |
|
| 400 | 400 | $this->TDBMObject_id = $this->db_row[$pk_array[0]]; |
| 401 | 401 | } |
| 402 | 402 | |
@@ -423,24 +423,24 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | // Let's add this object to the list of objects in cache. |
| 425 | 425 | $this->tdbmService->_addToCache($this); |
| 426 | - } else if ($this->TDBMObject_state == "loaded" && $this->db_modified_state==true) { |
|
| 426 | + } else if ($this->TDBMObject_state == "loaded" && $this->db_modified_state == true) { |
|
| 427 | 427 | //$primary_key = $this->getPrimaryKey(); |
| 428 | 428 | // Let's first get the primary keys |
| 429 | 429 | $pk_table = $this->getPrimaryKey(); |
| 430 | 430 | // Now for the object_id |
| 431 | 431 | $object_id = $this->TDBMObject_id; |
| 432 | 432 | // If there is only one primary key: |
| 433 | - if (count($pk_table)==1) { |
|
| 433 | + if (count($pk_table) == 1) { |
|
| 434 | 434 | $sql_where = $this->db_connection->escapeDBItem($pk_table[0])."=".$this->db_connection->quoteSmart($this->TDBMObject_id); |
| 435 | 435 | } else { |
| 436 | 436 | $ids = unserialize($object_id); |
| 437 | - $i=0; |
|
| 437 | + $i = 0; |
|
| 438 | 438 | $sql_where_array = array(); |
| 439 | 439 | foreach ($pk_table as $pk) { |
| 440 | 440 | $sql_where_array[] = $this->db_connection->escapeDBItem($pk)."=".$this->db_connection->quoteSmart($ids[$i]); |
| 441 | 441 | $i++; |
| 442 | 442 | } |
| 443 | - $sql_where = implode(" AND ",$sql_where_array); |
|
| 443 | + $sql_where = implode(" AND ", $sql_where_array); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | $sql = 'UPDATE '.$this->db_connection->escapeDBItem($this->db_table_name).' SET '; |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | if (!$first) |
| 451 | 451 | $sql .= ','; |
| 452 | 452 | $sql .= $this->db_connection->escapeDBItem($key)." = ".$this->db_connection->quoteSmart($value); |
| 453 | - $first=false; |
|
| 453 | + $first = false; |
|
| 454 | 454 | } |
| 455 | 455 | $sql .= ' WHERE '.$sql_where/*$primary_key."='".$this->db_row[$primary_key]."'"*/; |
| 456 | 456 | try { |
@@ -512,8 +512,8 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | public function __call($func_name, $values) { |
| 514 | 514 | |
| 515 | - if (strpos($func_name,"get_") === 0) { |
|
| 516 | - $table = substr($func_name,4); |
|
| 515 | + if (strpos($func_name, "get_") === 0) { |
|
| 516 | + $table = substr($func_name, 4); |
|
| 517 | 517 | } else { |
| 518 | 518 | throw new TDBMException("Method ".$func_name." not found"); |
| 519 | 519 | } |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | * Implement the unique JsonSerializable method |
| 625 | 625 | * @return array |
| 626 | 626 | */ |
| 627 | - public function jsonSerialize(){ |
|
| 627 | + public function jsonSerialize() { |
|
| 628 | 628 | $this->_dbLoadIfNotLoaded(); |
| 629 | 629 | return $this->db_row; |
| 630 | 630 | } |
@@ -653,23 +653,23 @@ discard block |
||
| 653 | 653 | * |
| 654 | 654 | * @return string |
| 655 | 655 | */ |
| 656 | - private function getPrimaryKeyWhereStatement () { |
|
| 656 | + private function getPrimaryKeyWhereStatement() { |
|
| 657 | 657 | // Let's first get the primary keys |
| 658 | 658 | $pk_table = $this->getPrimaryKey(); |
| 659 | 659 | // Now for the object_id |
| 660 | 660 | $object_id = $this->TDBMObject_id; |
| 661 | 661 | // If there is only one primary key: |
| 662 | - if (count($pk_table)==1) { |
|
| 662 | + if (count($pk_table) == 1) { |
|
| 663 | 663 | $sql_where = $this->db_connection->escapeDBItem($this->db_table_name).'.'.$this->db_connection->escapeDBItem($pk_table[0])."=".$this->db_connection->quoteSmart($this->TDBMObject_id); |
| 664 | 664 | } else { |
| 665 | 665 | $ids = unserialize($object_id); |
| 666 | - $i=0; |
|
| 666 | + $i = 0; |
|
| 667 | 667 | $sql_where_array = array(); |
| 668 | 668 | foreach ($pk_table as $pk) { |
| 669 | 669 | $sql_where_array[] = $this->db_connection->escapeDBItem($this->db_table_name).'.'.$this->db_connection->escapeDBItem($pk)."=".$this->db_connection->quoteSmart($ids[$i]); |
| 670 | 670 | $i++; |
| 671 | 671 | } |
| 672 | - $sql_where = implode(" AND ",$sql_where_array); |
|
| 672 | + $sql_where = implode(" AND ", $sql_where_array); |
|
| 673 | 673 | } |
| 674 | 674 | return $sql_where; |
| 675 | 675 | } |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | /** |
| 678 | 678 | * Override the native php clone function for TDBMObjects |
| 679 | 679 | */ |
| 680 | - public function __clone(){ |
|
| 680 | + public function __clone() { |
|
| 681 | 681 | $this->_dbLoadIfNotLoaded(); |
| 682 | 682 | //First lets set the status to new (to enter the save function) |
| 683 | 683 | $this->TDBMObject_state = "new"; |
@@ -86,16 +86,16 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | if ($this->fetchStarted === false) { |
| 88 | 88 | // $keysStandardCased is an optimization to avoid calling toStandardCaseColumn on every cell of every row. |
| 89 | - foreach ($fullCaseRow as $key=>$value) { |
|
| 89 | + foreach ($fullCaseRow as $key=>$value) { |
|
| 90 | 90 | $this->keysStandardCased[$key] = $this->dbConnection->toStandardCaseColumn($key); |
| 91 | 91 | } |
| 92 | 92 | $this->fetchStarted = true; |
| 93 | 93 | } |
| 94 | - foreach ($fullCaseRow as $key=>$value) { |
|
| 95 | - $row[$this->keysStandardCased[$key]]=$value; |
|
| 94 | + foreach ($fullCaseRow as $key=>$value) { |
|
| 95 | + $row[$this->keysStandardCased[$key]] = $value; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (count($this->primary_keys)==1) |
|
| 98 | + if (count($this->primary_keys) == 1) |
|
| 99 | 99 | { |
| 100 | 100 | if (!isset($this->keysStandardCased[$this->primary_keys[0]])) { |
| 101 | 101 | throw new TDBMException("Bad SQL request passed to getObjectsFromSQL. The SQL request should return all the rows from the '".$this->table_name."' table. Could not find primary key in this set of rows. SQL request passed: ".$this->sql); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $obj->loadFromRow($row, $this->colsArray); |
| 132 | 132 | // Check that the object fetched from cache is from the requested class. |
| 133 | 133 | if ($this->className != null) { |
| 134 | - if (!is_subclass_of(get_class($obj), $this->className) && get_class($obj) != $this->className) { |
|
| 134 | + if (!is_subclass_of(get_class($obj), $this->className) && get_class($obj) != $this->className) { |
|
| 135 | 135 | throw new TDBMException("Error while calling TDBM: An object fetched from database is already present in TDBM cache and they do not share the same class. You requested the object to be of the class ".$this->className." but the object available locally is of the class ".get_class($obj)."."); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | // Check that the object fetched from cache is from the requested class. |
| 140 | 140 | if ($this->className != null) { |
| 141 | 141 | $this->className = ltrim($this->className, '\\'); |
| 142 | - if (!is_subclass_of(get_class($obj), $this->className) && get_class($obj) != $this->className) { |
|
| 142 | + if (!is_subclass_of(get_class($obj), $this->className) && get_class($obj) != $this->className) { |
|
| 143 | 143 | throw new TDBMException("Error while calling TDBM: An object fetched from database is already present in TDBM cache and they do not share the same class. You requested the object to be of the class ".$this->className." but the object available locally is of the class ".get_class($obj)."."); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->current = false; |
| 186 | 186 | else |
| 187 | 187 | return true; |
| 188 | - }else |
|
| 188 | + } else |
|
| 189 | 189 | $this->current = false; |
| 190 | 190 | return false; |
| 191 | 191 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function valid() |
| 211 | 211 | { |
| 212 | - return ($this->current != false) || (($this->cursor == -1) && ($this->count() > 0)); |
|
| 212 | + return ($this->current != false) || (($this->cursor == -1) && ($this->count()>0)); |
|
| 213 | 213 | } |
| 214 | 214 | /** |
| 215 | 215 | * Fetches first record and rewinds the cursor |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function hasNext() |
| 228 | 228 | { |
| 229 | - return ($this->count() > 0) && (($this->cursor + 1) < $this->count()); |
|
| 229 | + return ($this->count()>0) && (($this->cursor+1)<$this->count()); |
|
| 230 | 230 | } |
| 231 | 231 | /** |
| 232 | 232 | * Return the next record to which this cursor points, and advance the cursor |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | <div class="control-group"> |
| 38 | 38 | <label class="control-label">Cast dates as <code>DateTimeImmutable</code>:</label> |
| 39 | 39 | <div class="controls"> |
| 40 | - <input type="checkbox" name="castDatesToDateTime" value="1" <?php echo $this->castDatesToDateTime?'checked="checked"':"" ?>></input> |
|
| 40 | + <input type="checkbox" name="castDatesToDateTime" value="1" <?php echo $this->castDatesToDateTime ? 'checked="checked"' : "" ?>></input> |
|
| 41 | 41 | <span class="help-block">Select this option if you want dates to be returned as <code>DateTimeImmutable</code>. |
| 42 | 42 | This is highly recommended. If you do not select this box, getters and setters will return / expect a timestamp |
| 43 | 43 | (this was the default behaviour up to TDBM 3.3).</span> |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | <div class="control-group"> |
| 47 | 47 | <label class="control-label">Store dates / timestamps in UTC:</label> |
| 48 | 48 | <div class="controls"> |
| 49 | - <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc?'checked="checked"':"" ?>></input> |
|
| 49 | + <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc ? 'checked="checked"' : "" ?>></input> |
|
| 50 | 50 | <span class="help-block">Select this option if you want timestamps to be stored in UTC. |
| 51 | 51 | If your application supports several time zones, you should select this option to store all dates in |
| 52 | 52 | the same time zone.</span> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | <div class="control-group"> |
| 46 | 46 | <label class="control-label">Keep support for previous DAOs:</label> |
| 47 | 47 | <div class="controls"> |
| 48 | - <input type="checkbox" name="keepSupport" <?php echo $this->keepSupport?'checked="checked"':"" ?>></input> |
|
| 48 | + <input type="checkbox" name="keepSupport" <?php echo $this->keepSupport ? 'checked="checked"' : "" ?>></input> |
|
| 49 | 49 | <span class="help-block">DAOs generated before TDBM 2.3 had a different method signature. This will ensure this signature |
| 50 | 50 | is respected. Use this only if you are migrating legacy code.</span> |
| 51 | 51 | </div> |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | <div class="control-group"> |
| 54 | 54 | <label class="control-label">Cast dates as <code>DateTimeImmutable</code>:</label> |
| 55 | 55 | <div class="controls"> |
| 56 | - <input type="checkbox" name="castDatesToDateTime" value="1" <?php echo $this->castDatesToDateTime?'checked="checked"':"" ?>></input> |
|
| 56 | + <input type="checkbox" name="castDatesToDateTime" value="1" <?php echo $this->castDatesToDateTime ? 'checked="checked"' : "" ?>></input> |
|
| 57 | 57 | <span class="help-block">Select this option if you want dates to be returned as <code>DateTimeImmutable</code>. |
| 58 | 58 | This is highly recommended. If you do not select this box, getters and setters will return / expect a timestamp |
| 59 | 59 | (this was the default behaviour up to TDBM 3.3).</span> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | <div class="control-group"> |
| 63 | 63 | <label class="control-label">Store dates / timestamps in UTC:</label> |
| 64 | 64 | <div class="controls"> |
| 65 | - <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc?'checked="checked"':"" ?>></input> |
|
| 65 | + <input type="checkbox" name="storeInUtc" value="1" <?php echo $this->storeInUtc ? 'checked="checked"' : "" ?>></input> |
|
| 66 | 66 | <span class="help-block">Select this option if you want timestamps to be stored in UTC. |
| 67 | 67 | If your application supports several time zones, you should select this option to store all dates in |
| 68 | 68 | the same time zone.</span> |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | * @param string $columnName |
| 86 | 86 | * @param string $value |
| 87 | 87 | */ |
| 88 | - public function __construct($tableName=null, $columnName=null, $value=null) { |
|
| 88 | + public function __construct($tableName = null, $columnName = null, $value = null) { |
|
| 89 | 89 | $this->tableName = $tableName; |
| 90 | 90 | $this->columnName = $columnName; |
| 91 | 91 | $this->value = $value; |