Completed
Push — prado-3.3 ( f4da81...5dd4b5 )
by Fabio
09:03
created
framework/Data/Common/Pgsql/TPgsqlTableColumn.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 	 */
36 36
 	public function getPHPType()
37 37
 	{
38
-		$dbtype = strtolower($this->getDbType());
38
+		$dbtype=strtolower($this->getDbType());
39 39
 		foreach(self::$types as $type => $dbtypes)
40 40
 		{
41 41
 			if(in_array($dbtype, $dbtypes))
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function getSearchExpression($fields, $keywords)
32 32
 	{
33
-		$columns = array();
33
+		$columns=array();
34 34
 		foreach($fields as $field)
35 35
 		{
36 36
 			if($this->isSearchableColumn($this->getTableInfo()->getColumn($field)))
37
-				$columns[] = $field;
37
+				$columns[]=$field;
38 38
 		}
39 39
 		return parent::getSearchExpression($columns, $keywords);
40 40
 	}
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	protected function isSearchableColumn($column)
46 46
 	{
47
-		$type = strtolower($column->getDbType());
48
-		return $type === 'character varying' || $type === 'varchar' ||
49
-				$type === 'character' || $type === 'char' || $type === 'text';
47
+		$type=strtolower($column->getDbType());
48
+		return $type==='character varying' || $type==='varchar' ||
49
+				$type==='character' || $type==='char' || $type==='text';
50 50
 	}
51 51
 
52 52
 	/**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	{
60 60
 		$conditions=array();
61 61
 		foreach($words as $word)
62
-			$conditions[] = $column.' ILIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
62
+			$conditions[]=$column.' ILIKE '.$this->getDbConnection()->quoteString('%'.$word.'%');
63 63
 		return '('.implode(' AND ', $conditions).')';
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlCommandBuilder.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		{
32 32
 			if($column->hasSequence())
33 33
 			{
34
-				$command = $this->getDbConnection()->createCommand('SELECT @@Identity');
34
+				$command=$this->getDbConnection()->createCommand('SELECT @@Identity');
35 35
 				return intval($command->queryScalar());
36 36
 			}
37 37
 		}
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function applyLimitOffset($sql, $limit=-1, $offset=-1)
81 81
 	{
82
-		$limit = $limit!==null ? intval($limit) : -1;
83
-		$offset = $offset!==null ? intval($offset) : -1;
84
-		if ($limit > 0 && $offset <= 0) //just limit
85
-			$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i',"\\1SELECT\\2 TOP $limit", $sql);
82
+		$limit=$limit!==null ? intval($limit) : -1;
83
+		$offset=$offset!==null ? intval($offset) : -1;
84
+		if($limit > 0 && $offset <= 0) //just limit
85
+			$sql=preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql);
86 86
 		else if($limit > 0 && $offset > 0)
87
-			$sql = $this->rewriteLimitOffsetSql($sql, $limit,$offset);
87
+			$sql=$this->rewriteLimitOffsetSql($sql, $limit, $offset);
88 88
 		return $sql;
89 89
 	}
90 90
 
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	protected function rewriteLimitOffsetSql($sql, $limit, $offset)
100 100
 	{
101
-		$fetch = $limit+$offset;
102
-		$sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i',"\\1SELECT\\2 TOP $fetch", $sql);
103
-		$ordering = $this->findOrdering($sql);
101
+		$fetch=$limit + $offset;
102
+		$sql=preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $fetch", $sql);
103
+		$ordering=$this->findOrdering($sql);
104 104
 
105
-		$orginalOrdering = $this->joinOrdering($ordering);
106
-		$reverseOrdering = $this->joinOrdering($this->reverseDirection($ordering));
107
-		$sql = "SELECT * FROM (SELECT TOP {$limit} * FROM ($sql) as [__inner top table__] {$reverseOrdering}) as [__outer top table__] {$orginalOrdering}";
105
+		$orginalOrdering=$this->joinOrdering($ordering);
106
+		$reverseOrdering=$this->joinOrdering($this->reverseDirection($ordering));
107
+		$sql="SELECT * FROM (SELECT TOP {$limit} * FROM ($sql) as [__inner top table__] {$reverseOrdering}) as [__outer top table__] {$orginalOrdering}";
108 108
 		return $sql;
109 109
 	}
110 110
 
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 		$matches=array();
122 122
 		$ordering=array();
123 123
 		preg_match_all('/(ORDER BY)[\s"\[](.*)(ASC|DESC)?(?:[\s"\[]|$|COMPUTE|FOR)/i', $sql, $matches);
124
-		if(count($matches)>1 && count($matches[2]) > 0)
124
+		if(count($matches) > 1 && count($matches[2]) > 0)
125 125
 		{
126
-			$parts = explode(',', $matches[2][0]);
126
+			$parts=explode(',', $matches[2][0]);
127 127
 			foreach($parts as $part)
128 128
 			{
129 129
 				$subs=array();
@@ -131,12 +131,12 @@  discard block
 block discarded – undo
131 131
 				{
132 132
 					if(count($subs) > 1 && count($subs[2]) > 0)
133 133
 					{
134
-						$ordering[$subs[1][0]] = $subs[2][0];
134
+						$ordering[$subs[1][0]]=$subs[2][0];
135 135
 					}
136 136
 					//else what?
137 137
 				}
138 138
 				else
139
-					$ordering[trim($part)] = 'ASC';
139
+					$ordering[trim($part)]='ASC';
140 140
 			}
141 141
 		}
142 142
 		return $ordering;
@@ -148,11 +148,11 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	protected function joinOrdering($orders)
150 150
 	{
151
-		if(count($orders)>0)
151
+		if(count($orders) > 0)
152 152
 		{
153 153
 			$str=array();
154 154
 			foreach($orders as $column => $direction)
155
-				$str[] = $column.' '.$direction;
155
+				$str[]=$column.' '.$direction;
156 156
 			return 'ORDER BY '.implode(', ', $str);
157 157
 		}
158 158
 	}
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	protected function reverseDirection($orders)
165 165
 	{
166 166
 		foreach($orders as $column => $direction)
167
-			$orders[$column] = strtolower(trim($direction))==='desc' ? 'ASC' : 'DESC';
167
+			$orders[$column]=strtolower(trim($direction))==='desc' ? 'ASC' : 'DESC';
168 168
 		return $orders;
169 169
 	}
170 170
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
70 70
 				{
71 71
 					$domain=substr($value,$pos+1);
72 72
 					return $domain===''?false:checkdnsrr($domain,'MX');
73
-				}
74
-				else
73
+				} else
75 74
 					return false;
76 75
 			}
77 76
 		}
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlTableInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 	public function createCommandBuilder($connection)
57 57
 	{
58 58
 		Prado::using('System.Data.Common.Mssql.TMssqlCommandBuilder');
59
-		return new TMssqlCommandBuilder($connection,$this);
59
+		return new TMssqlCommandBuilder($connection, $this);
60 60
 	}
61 61
 }
62 62
 
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlTableInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function createCommandBuilder($connection)
51 51
 	{
52 52
 		Prado::using('System.Data.Common.Mysql.TMysqlCommandBuilder');
53
-		return new TMysqlCommandBuilder($connection,$this);
53
+		return new TMysqlCommandBuilder($connection, $this);
54 54
 	}
55 55
 }
56 56
 
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlTableColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class TMysqlTableColumn extends TDbTableColumn
25 25
 {
26
-	private static $types = array(
26
+	private static $types=array(
27 27
 		'integer' => array('bit', 'tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint'),
28 28
 		'boolean' => array('boolean', 'bool'),
29 29
 		'float' => array('float', 'double', 'double precision', 'decimal', 'dec', 'numeric', 'fixed')
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function getPHPType()
37 37
 	{
38
-		$dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($this->getDbType())));
38
+		$dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($this->getDbType())));
39 39
 		if($dbtype==='tinyint' && $this->getColumnSize()===1)
40 40
 			return 'boolean';
41 41
 		foreach(self::$types as $type => $dbtypes)
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	public function createCommandBuilder($connection)
32 32
 	{
33 33
 		Prado::using('System.Data.Common.Sqlite.TSqliteCommandBuilder');
34
-		return new TSqliteCommandBuilder($connection,$this);
34
+		return new TSqliteCommandBuilder($connection, $this);
35 35
 	}
36 36
 
37 37
 	/**
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @TODO add sqlite types.
28 28
 	 */
29
-	private static $types = array();
29
+	private static $types=array();
30 30
 
31 31
 	/**
32 32
 	 * Overrides parent implementation, returns PHP type from the db type.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function getPHPType()
36 36
 	{
37
-		$dbtype = strtolower($this->getDbType());
37
+		$dbtype=strtolower($this->getDbType());
38 38
 		foreach(self::$types as $type => $dbtypes)
39 39
 		{
40 40
 			if(in_array($dbtype, $dbtypes))
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	protected function collectForeignObjects(&$results)
79 79
 	{
80
-		$fkeys = $this->getRelationForeignKeys();
80
+		$fkeys=$this->getRelationForeignKeys();
81 81
 
82
-		$properties = array_keys($fkeys);
83
-		$fields = array_values($fkeys);
84
-		$indexValues = $this->getIndexValues($properties, $results);
85
-		$fkObjects = $this->findForeignObjects($fields, $indexValues);
86
-		$this->populateResult($results,$properties,$fkObjects,$fields);
82
+		$properties=array_keys($fkeys);
83
+		$fields=array_values($fkeys);
84
+		$indexValues=$this->getIndexValues($properties, $results);
85
+		$fkObjects=$this->findForeignObjects($fields, $indexValues);
86
+		$this->populateResult($results, $properties, $fkObjects, $fields);
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function getRelationForeignKeys()
94 94
 	{
95
-		$fkObject = $this->getContext()->getForeignRecordFinder();
96
-		return $this->findForeignKeys($this->getSourceRecord(),$fkObject);
95
+		$fkObject=$this->getContext()->getForeignRecordFinder();
96
+		return $this->findForeignKeys($this->getSourceRecord(), $fkObject);
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function setObjectProperty($source, $properties, &$collections)
105 105
 	{
106
-		$hash = $this->getObjectHash($source, $properties);
107
-		$prop = $this->getContext()->getProperty();
106
+		$hash=$this->getObjectHash($source, $properties);
107
+		$prop=$this->getContext()->getProperty();
108 108
 		if(isset($collections[$hash]) && count($collections[$hash]) > 0)
109 109
 		{
110 110
 			if(count($collections[$hash]) > 1)
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function updateAssociatedRecords()
123 123
 	{
124
-		$obj = $this->getContext()->getSourceRecord();
125
-		$fkObject = $obj->getColumnValue($this->getContext()->getProperty());
124
+		$obj=$this->getContext()->getSourceRecord();
125
+		$fkObject=$obj->getColumnValue($this->getContext()->getProperty());
126 126
 		if($fkObject!==null)
127 127
 		{
128 128
 			$fkObject->save();
129
-			$source = $this->getSourceRecord();
130
-			$fkeys = $this->findForeignKeys($source, $fkObject);
129
+			$source=$this->getSourceRecord();
130
+			$fkeys=$this->findForeignKeys($source, $fkObject);
131 131
 			foreach($fkeys as $srcKey => $fKey)
132 132
 				$source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
133 133
 			return true;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.