@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Data Model implementation for this class |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$objTables->getNamespace()?> |
9 | - * @see <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName ( $objTables->getName () )?>. "\n"?> |
|
9 | + * @see <?=$objTables->getNamespace()?>/Model/<?=$this->getClassName($objTables->getName())?>. "\n"?> |
|
10 | 10 | * |
11 | - * @author <?=$this->config->author."\n"?> |
|
11 | + * @author <?=$this->config->author . "\n"?> |
|
12 | 12 | * |
13 | - * @copyright <?=$this->config->copyright."\n"?> |
|
14 | - * @license <?=$this->config->license."\n"?> |
|
15 | - * @link <?=$this->config->link."\n"?> |
|
13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
14 | + * @license <?=$this->config->license . "\n"?> |
|
15 | + * @link <?=$this->config->link . "\n"?> |
|
16 | 16 | */ |
17 | 17 | |
18 | -class <?=$this->getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$this->getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -3,20 +3,20 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Application Model DbTables |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * Tabela definida por 'tablename' |
9 | 9 | * |
10 | 10 | * @package <?=$objTables->getNamespace()?><?="\n"?> |
11 | 11 | * @subpackage DbTable |
12 | - * @author <?=$this->config->author."\n"?> |
|
12 | + * @author <?=$this->config->author . "\n"?> |
|
13 | 13 | * |
14 | - * @copyright <?=$this->config->copyright."\n"?> |
|
15 | - * @license <?=$this->config->license."\n"?> |
|
16 | - * @link <?=$this->config->link."\n"?> |
|
14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
15 | + * @license <?=$this->config->license . "\n"?> |
|
16 | + * @link <?=$this->config->link . "\n"?> |
|
17 | 17 | */ |
18 | 18 | |
19 | -class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
19 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
20 | 20 | { |
21 | 21 | /** |
22 | 22 | * Nome da tabela do banco de dados |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @access protected |
26 | 26 | */ |
27 | 27 | protected $_name = '<?=$objTables->getName()?>'; |
28 | -<?php if($objTables->hasSchema()): ?> |
|
28 | +<?php if ($objTables->hasSchema()): ?> |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Schema da tabela do banco de dados |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @var string |
43 | 43 | * @access protected |
44 | 44 | */ |
45 | - protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
45 | + protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
46 | 46 | |
47 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
47 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
48 | 48 | /** |
49 | 49 | * Nome da Primary Key |
50 | 50 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @access protected |
53 | 53 | */ |
54 | 54 | protected $_primary = array( |
55 | -<?php foreach($objTables->getPrimaryKeys() as $pks):?> |
|
55 | +<?php foreach ($objTables->getPrimaryKeys() as $pks):?> |
|
56 | 56 | '<?=$pks->getName()?>', |
57 | 57 | <?php endforeach; ?> |
58 | 58 | ); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @var mixed |
65 | 65 | */ |
66 | -<?php if( $objTables->hasSequences() ) : ?> |
|
67 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
68 | -<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
66 | +<?php if ($objTables->hasSequences()) : ?> |
|
67 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
68 | +<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
69 | 69 | protected $_sequence = '<?=$seq->getSequence() ?>'; |
70 | 70 | <?php endif ?> |
71 | 71 | <?php else: ?> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @var array |
54 | 54 | */ |
55 | - private $argv = array (); |
|
55 | + private $argv = array(); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var \Classes\AdapterConfig\AbstractAdapter |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private $adapterDriver; |
66 | 66 | |
67 | - public function __construct ( $argv , $basePath ) |
|
67 | + public function __construct($argv, $basePath) |
|
68 | 68 | { |
69 | - if ( array_key_exists ( 'help' , $argv ) ) |
|
69 | + if (array_key_exists('help', $argv)) |
|
70 | 70 | { |
71 | - die ( $this->getUsage () ); |
|
71 | + die ($this->getUsage()); |
|
72 | 72 | } |
73 | - if ( array_key_exists ( 'status' , $argv ) ) |
|
73 | + if (array_key_exists('status', $argv)) |
|
74 | 74 | { |
75 | - $argv[ 'status' ] = true; |
|
75 | + $argv['status'] = true; |
|
76 | 76 | } |
77 | 77 | |
78 | - $this->argv = $this->parseConfig ( $basePath , $argv ); |
|
78 | + $this->argv = $this->parseConfig($basePath, $argv); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function getUsage () |
|
86 | + public function getUsage() |
|
87 | 87 | { |
88 | 88 | $version = $this->getVersion(); |
89 | 89 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | EOF; |
109 | 109 | } |
110 | 110 | |
111 | - public function getVersion () |
|
111 | + public function getVersion() |
|
112 | 112 | { |
113 | 113 | $version = static::$version; |
114 | 114 | |
@@ -124,22 +124,22 @@ discard block |
||
124 | 124 | * @return array |
125 | 125 | * @throws \Exception |
126 | 126 | */ |
127 | - private function parseConfig ( $basePath , $argv ) |
|
127 | + private function parseConfig($basePath, $argv) |
|
128 | 128 | { |
129 | - $this->_basePath = dirname ( $basePath ); |
|
129 | + $this->_basePath = dirname($basePath); |
|
130 | 130 | |
131 | - $configIni = isset( $argv[ 'config-ini' ] ) ? $argv[ 'config-ini' ] |
|
131 | + $configIni = isset($argv['config-ini']) ? $argv['config-ini'] |
|
132 | 132 | : $this->_basePath . $this->configIniDefault; |
133 | 133 | |
134 | - $configTemp = $this->loadIniFile ( realpath ( $configIni ) ); |
|
135 | - $configCurrent = self::parseConfigEnv ( $configTemp , $argv ); |
|
134 | + $configTemp = $this->loadIniFile(realpath($configIni)); |
|
135 | + $configCurrent = self::parseConfigEnv($configTemp, $argv); |
|
136 | 136 | |
137 | - if ( ! isset( $configCurrent[ 'framework' ] ) ) |
|
137 | + if ( ! isset($configCurrent['framework'])) |
|
138 | 138 | { |
139 | - throw new \Exception( "configure which framework you want to use! \n" ); |
|
139 | + throw new \Exception("configure which framework you want to use! \n"); |
|
140 | 140 | } |
141 | 141 | |
142 | - return $argv + array_filter ( $configCurrent ); |
|
142 | + return $argv + array_filter($configCurrent); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - private static function parseConfigEnv ( $configTemp , $argv ) |
|
152 | + private static function parseConfigEnv($configTemp, $argv) |
|
153 | 153 | { |
154 | - $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] ) ? |
|
155 | - $configTemp[ key ( $configTemp ) ][ 'config-env' ] : null; |
|
154 | + $thisSection = isset($configTemp[key($configTemp)]['config-env']) ? |
|
155 | + $configTemp[key($configTemp)]['config-env'] : null; |
|
156 | 156 | |
157 | - $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ] |
|
157 | + $thisSection = isset($argv['config-env']) ? $argv['config-env'] |
|
158 | 158 | : $thisSection; |
159 | 159 | |
160 | - if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) ) |
|
160 | + if (isset($configTemp[$thisSection]['extends'])) |
|
161 | 161 | { |
162 | 162 | #faz marge da config principal com a config extendida |
163 | - return $configTemp[ $thisSection ] |
|
164 | - + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ]; |
|
163 | + return $configTemp[$thisSection] |
|
164 | + + $configTemp[$configTemp[$thisSection]['extends']]; |
|
165 | 165 | } |
166 | 166 | |
167 | - return $configTemp[ key ( $configTemp ) ]; |
|
167 | + return $configTemp[key($configTemp)]; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -178,32 +178,32 @@ discard block |
||
178 | 178 | * @throws \Exception |
179 | 179 | * @return array |
180 | 180 | */ |
181 | - protected function loadIniFile ( $filename ) |
|
181 | + protected function loadIniFile($filename) |
|
182 | 182 | { |
183 | - if ( ! is_file ( $filename ) ) |
|
183 | + if ( ! is_file($filename)) |
|
184 | 184 | { |
185 | - throw new \Exception( "configuration file does not exist! \n" ); |
|
185 | + throw new \Exception("configuration file does not exist! \n"); |
|
186 | 186 | } |
187 | 187 | |
188 | - $loaded = parse_ini_file ( $filename , true ); |
|
189 | - $iniArray = array (); |
|
190 | - foreach ( $loaded as $key => $data ) |
|
188 | + $loaded = parse_ini_file($filename, true); |
|
189 | + $iniArray = array(); |
|
190 | + foreach ($loaded as $key => $data) |
|
191 | 191 | { |
192 | - $pieces = explode ( $this->sectionSeparator , $key ); |
|
193 | - $thisSection = trim ( $pieces[ 0 ] ); |
|
194 | - switch ( count ( $pieces ) ) |
|
192 | + $pieces = explode($this->sectionSeparator, $key); |
|
193 | + $thisSection = trim($pieces[0]); |
|
194 | + switch (count($pieces)) |
|
195 | 195 | { |
196 | 196 | case 1: |
197 | - $iniArray[ $thisSection ] = $data; |
|
197 | + $iniArray[$thisSection] = $data; |
|
198 | 198 | break; |
199 | 199 | |
200 | 200 | case 2: |
201 | - $extendedSection = trim ( $pieces[ 1 ] ); |
|
202 | - $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ) , $data ); |
|
201 | + $extendedSection = trim($pieces[1]); |
|
202 | + $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data); |
|
203 | 203 | break; |
204 | 204 | |
205 | 205 | default: |
206 | - throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" ); |
|
206 | + throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename"); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | * @return \Classes\AdapterConfig\AbstractAdapter |
217 | 217 | * |
218 | 218 | */ |
219 | - private function factoryConfig () |
|
219 | + private function factoryConfig() |
|
220 | 220 | { |
221 | - switch ( strtolower ( $this->argv[ 'framework' ] ) ) |
|
221 | + switch (strtolower($this->argv['framework'])) |
|
222 | 222 | { |
223 | 223 | case 'zf1': |
224 | - return new ZendFrameworkOne( $this->argv ); |
|
224 | + return new ZendFrameworkOne($this->argv); |
|
225 | 225 | case 'phalcon': |
226 | - return new Phalcon( $this->argv ); |
|
226 | + return new Phalcon($this->argv); |
|
227 | 227 | default: |
228 | - return new None( $this->argv ); |
|
228 | + return new None($this->argv); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | } |
@@ -235,33 +235,33 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return \Classes\AdapterConfig\AbstractAdapter |
237 | 237 | */ |
238 | - private function factoryDriver () |
|
238 | + private function factoryDriver() |
|
239 | 239 | { |
240 | - switch ( $this->argv[ 'driver' ] ) |
|
240 | + switch ($this->argv['driver']) |
|
241 | 241 | { |
242 | 242 | case 'pgsql': |
243 | 243 | case 'pdo_pgsql': |
244 | - return new Pgsql( $this->getAdapterConfig () ); |
|
244 | + return new Pgsql($this->getAdapterConfig()); |
|
245 | 245 | case 'mysql': |
246 | 246 | case 'pdo_mysql': |
247 | - return new Mysql( $this->getAdapterConfig () ); |
|
247 | + return new Mysql($this->getAdapterConfig()); |
|
248 | 248 | case 'mssql': |
249 | - return new Mssql( $this->getAdapterConfig () ); |
|
249 | + return new Mssql($this->getAdapterConfig()); |
|
250 | 250 | case 'dblib': |
251 | - return new Dblib( $this->getAdapterConfig () ); |
|
251 | + return new Dblib($this->getAdapterConfig()); |
|
252 | 252 | case 'sqlsrv': |
253 | - return new Sqlsrv( $this->getAdapterConfig () ); |
|
253 | + return new Sqlsrv($this->getAdapterConfig()); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
258 | 258 | * @return AdapterConfig\AbstractAdapter |
259 | 259 | */ |
260 | - public function getAdapterConfig () |
|
260 | + public function getAdapterConfig() |
|
261 | 261 | { |
262 | - if ( ! $this->adapterConfig instanceof AbstractAdapter ) |
|
262 | + if ( ! $this->adapterConfig instanceof AbstractAdapter) |
|
263 | 263 | { |
264 | - $this->adapterConfig = $this->factoryConfig (); |
|
264 | + $this->adapterConfig = $this->factoryConfig(); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | return $this->adapterConfig; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | /** |
271 | 271 | * @return AdaptersDriver\AbsractAdapter |
272 | 272 | */ |
273 | - public function getAdapterDriver () |
|
273 | + public function getAdapterDriver() |
|
274 | 274 | { |
275 | - if ( ! $this->adapterDriver ) |
|
275 | + if ( ! $this->adapterDriver) |
|
276 | 276 | { |
277 | - $this->adapterDriver = $this->factoryDriver (); |
|
277 | + $this->adapterDriver = $this->factoryDriver(); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $this->adapterDriver; |