@@ -135,7 +135,7 @@ |
||
| 135 | 135 | $configIni = isset( $argv[ 'config-ini' ] ) |
| 136 | 136 | ? $argv[ 'config-ini' ] |
| 137 | 137 | : $this->_basePath |
| 138 | - . $this->configIniDefault; |
|
| 138 | + . $this->configIniDefault; |
|
| 139 | 139 | |
| 140 | 140 | $configTemp = $this->loadIniFile ( realpath ( $configIni ) ); |
| 141 | 141 | $configCurrent = self::parseConfigEnv ( $configTemp, $argv ); |
@@ -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,22 +64,22 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | private $adapterDriver; |
| 66 | 66 | |
| 67 | - private $frameworkList = array ( |
|
| 67 | + private $frameworkList = array( |
|
| 68 | 68 | 'none', |
| 69 | 69 | 'zf1', |
| 70 | 70 | 'phalcon' |
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | - public function __construct ( $argv, $basePath ) |
|
| 73 | + public function __construct($argv, $basePath) |
|
| 74 | 74 | { |
| 75 | - if ( array_key_exists ( 'help', $argv ) ) { |
|
| 76 | - die ( $this->getUsage () ); |
|
| 75 | + if (array_key_exists('help', $argv)) { |
|
| 76 | + die ($this->getUsage()); |
|
| 77 | 77 | } |
| 78 | - if ( array_key_exists ( 'status', $argv ) ) { |
|
| 79 | - $argv[ 'status' ] = true; |
|
| 78 | + if (array_key_exists('status', $argv)) { |
|
| 79 | + $argv['status'] = true; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $this->argv = $this->parseConfig ( $basePath, $argv ); |
|
| 82 | + $this->argv = $this->parseConfig($basePath, $argv); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - public function getUsage () |
|
| 90 | + public function getUsage() |
|
| 91 | 91 | { |
| 92 | - $version = $this->getVersion (); |
|
| 92 | + $version = $this->getVersion(); |
|
| 93 | 93 | |
| 94 | 94 | return <<<EOF |
| 95 | 95 | parameters: |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | EOF; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - public function getVersion () |
|
| 115 | + public function getVersion() |
|
| 116 | 116 | { |
| 117 | 117 | $version = static::$version; |
| 118 | 118 | |
@@ -128,28 +128,28 @@ discard block |
||
| 128 | 128 | * @return array |
| 129 | 129 | * @throws \Exception |
| 130 | 130 | */ |
| 131 | - private function parseConfig ( $basePath, $argv ) |
|
| 131 | + private function parseConfig($basePath, $argv) |
|
| 132 | 132 | { |
| 133 | - $this->_basePath = dirname ( $basePath ); |
|
| 133 | + $this->_basePath = dirname($basePath); |
|
| 134 | 134 | |
| 135 | - $configIni = isset( $argv[ 'config-ini' ] ) |
|
| 136 | - ? $argv[ 'config-ini' ] |
|
| 135 | + $configIni = isset($argv['config-ini']) |
|
| 136 | + ? $argv['config-ini'] |
|
| 137 | 137 | : $this->_basePath |
| 138 | 138 | . $this->configIniDefault; |
| 139 | 139 | |
| 140 | - $configTemp = $this->loadIniFile ( realpath ( $configIni ) ); |
|
| 141 | - $configCurrent = self::parseConfigEnv ( $configTemp, $argv ); |
|
| 140 | + $configTemp = $this->loadIniFile(realpath($configIni)); |
|
| 141 | + $configCurrent = self::parseConfigEnv($configTemp, $argv); |
|
| 142 | 142 | |
| 143 | - if ( !isset( $configCurrent[ 'framework' ] ) ) { |
|
| 144 | - throw new \Exception( "configure which framework you want to use! \n" ); |
|
| 143 | + if ( ! isset($configCurrent['framework'])) { |
|
| 144 | + throw new \Exception("configure which framework you want to use! \n"); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if ( !in_array ( $configCurrent[ 'framework' ], $this->frameworkList ) ) { |
|
| 148 | - $frameworks = implode ( "\n\t", $this->frameworkList ); |
|
| 149 | - throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks . "\n\033[0m" ); |
|
| 147 | + if ( ! in_array($configCurrent['framework'], $this->frameworkList)) { |
|
| 148 | + $frameworks = implode("\n\t", $this->frameworkList); |
|
| 149 | + throw new \Exception("list of frameworks: \n\t\033[1;33m" . $frameworks . "\n\033[0m"); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - return $argv + array_filter ( $configCurrent ); |
|
| 152 | + return $argv + array_filter($configCurrent); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | /** |
@@ -159,20 +159,20 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @return string |
| 161 | 161 | */ |
| 162 | - private static function parseConfigEnv ( $configTemp, $argv ) |
|
| 162 | + private static function parseConfigEnv($configTemp, $argv) |
|
| 163 | 163 | { |
| 164 | - $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] ) ? $configTemp[ key ( |
|
| 164 | + $thisSection = isset($configTemp[key($configTemp)]['config-env']) ? $configTemp[key( |
|
| 165 | 165 | $configTemp |
| 166 | - ) ][ 'config-env' ] : null; |
|
| 166 | + )]['config-env'] : null; |
|
| 167 | 167 | |
| 168 | - $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ] : $thisSection; |
|
| 168 | + $thisSection = isset($argv['config-env']) ? $argv['config-env'] : $thisSection; |
|
| 169 | 169 | |
| 170 | - if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) ) { |
|
| 170 | + if (isset($configTemp[$thisSection]['extends'])) { |
|
| 171 | 171 | #faz marge da config principal com a config extendida |
| 172 | - return $configTemp[ $thisSection ] + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ]; |
|
| 172 | + return $configTemp[$thisSection] + $configTemp[$configTemp[$thisSection]['extends']]; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - return $configTemp[ key ( $configTemp ) ]; |
|
| 175 | + return $configTemp[key($configTemp)]; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
@@ -186,29 +186,29 @@ discard block |
||
| 186 | 186 | * @throws \Exception |
| 187 | 187 | * @return array |
| 188 | 188 | */ |
| 189 | - protected function loadIniFile ( $filename ) |
|
| 189 | + protected function loadIniFile($filename) |
|
| 190 | 190 | { |
| 191 | - if ( !is_file ( $filename ) ) { |
|
| 192 | - throw new \Exception( "configuration file does not exist! \n" ); |
|
| 191 | + if ( ! is_file($filename)) { |
|
| 192 | + throw new \Exception("configuration file does not exist! \n"); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $loaded = parse_ini_file ( $filename, true ); |
|
| 196 | - $iniArray = array (); |
|
| 197 | - foreach ( $loaded as $key => $data ) { |
|
| 198 | - $pieces = explode ( $this->sectionSeparator, $key ); |
|
| 199 | - $thisSection = trim ( $pieces[ 0 ] ); |
|
| 200 | - switch ( count ( $pieces ) ) { |
|
| 195 | + $loaded = parse_ini_file($filename, true); |
|
| 196 | + $iniArray = array(); |
|
| 197 | + foreach ($loaded as $key => $data) { |
|
| 198 | + $pieces = explode($this->sectionSeparator, $key); |
|
| 199 | + $thisSection = trim($pieces[0]); |
|
| 200 | + switch (count($pieces)) { |
|
| 201 | 201 | case 1: |
| 202 | - $iniArray[ $thisSection ] = $data; |
|
| 202 | + $iniArray[$thisSection] = $data; |
|
| 203 | 203 | break; |
| 204 | 204 | |
| 205 | 205 | case 2: |
| 206 | - $extendedSection = trim ( $pieces[ 1 ] ); |
|
| 207 | - $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ), $data ); |
|
| 206 | + $extendedSection = trim($pieces[1]); |
|
| 207 | + $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data); |
|
| 208 | 208 | break; |
| 209 | 209 | |
| 210 | 210 | default: |
| 211 | - throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" ); |
|
| 211 | + throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename"); |
|
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | 214 | |
@@ -221,15 +221,15 @@ discard block |
||
| 221 | 221 | * @return \Classes\AdapterConfig\AbstractAdapter |
| 222 | 222 | * |
| 223 | 223 | */ |
| 224 | - private function factoryConfig () |
|
| 224 | + private function factoryConfig() |
|
| 225 | 225 | { |
| 226 | - switch ( strtolower ( $this->argv[ 'framework' ] ) ) { |
|
| 226 | + switch (strtolower($this->argv['framework'])) { |
|
| 227 | 227 | case 'zf1': |
| 228 | - return new ZendFrameworkOne( $this->argv ); |
|
| 228 | + return new ZendFrameworkOne($this->argv); |
|
| 229 | 229 | case 'phalcon': |
| 230 | - return new Phalcon( $this->argv ); |
|
| 230 | + return new Phalcon($this->argv); |
|
| 231 | 231 | default: |
| 232 | - return new None( $this->argv ); |
|
| 232 | + return new None($this->argv); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | } |
@@ -241,31 +241,31 @@ discard block |
||
| 241 | 241 | * |
| 242 | 242 | * @return AdaptersDriver\AbsractAdapter |
| 243 | 243 | */ |
| 244 | - private function factoryDriver ( AdapterConfig\AbstractAdapter $config ) |
|
| 244 | + private function factoryDriver(AdapterConfig\AbstractAdapter $config) |
|
| 245 | 245 | { |
| 246 | - switch ( $this->argv[ 'driver' ] ) { |
|
| 246 | + switch ($this->argv['driver']) { |
|
| 247 | 247 | case 'pgsql': |
| 248 | 248 | case 'pdo_pgsql': |
| 249 | - return new Pgsql( $config ); |
|
| 249 | + return new Pgsql($config); |
|
| 250 | 250 | case 'mysql': |
| 251 | 251 | case 'pdo_mysql': |
| 252 | - return new Mysql( $config ); |
|
| 252 | + return new Mysql($config); |
|
| 253 | 253 | case 'mssql': |
| 254 | - return new Mssql( $config ); |
|
| 254 | + return new Mssql($config); |
|
| 255 | 255 | case 'dblib': |
| 256 | - return new Dblib( $config ); |
|
| 256 | + return new Dblib($config); |
|
| 257 | 257 | case 'sqlsrv': |
| 258 | - return new Sqlsrv( $config ); |
|
| 258 | + return new Sqlsrv($config); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
| 263 | 263 | * @return AdapterConfig\AbstractAdapter |
| 264 | 264 | */ |
| 265 | - public function getAdapterConfig () |
|
| 265 | + public function getAdapterConfig() |
|
| 266 | 266 | { |
| 267 | - if ( !$this->adapterConfig instanceof AbstractAdapter ) { |
|
| 268 | - $this->adapterConfig = $this->factoryConfig (); |
|
| 267 | + if ( ! $this->adapterConfig instanceof AbstractAdapter) { |
|
| 268 | + $this->adapterConfig = $this->factoryConfig(); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | return $this->adapterConfig; |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | /** |
| 275 | 275 | * @return AdaptersDriver\AbsractAdapter |
| 276 | 276 | */ |
| 277 | - public function getAdapterDriver ( AdapterConfig\AbstractAdapter $config ) |
|
| 277 | + public function getAdapterDriver(AdapterConfig\AbstractAdapter $config) |
|
| 278 | 278 | { |
| 279 | - if ( !$this->adapterDriver ) { |
|
| 280 | - $this->adapterDriver = $this->factoryDriver ( $config ); |
|
| 279 | + if ( ! $this->adapterDriver) { |
|
| 280 | + $this->adapterDriver = $this->factoryDriver($config); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | return $this->adapterDriver; |
@@ -134,8 +134,7 @@ |
||
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | |
| 137 | - } |
|
| 138 | - else { |
|
| 137 | + } else { |
|
| 139 | 138 | $url = array ( |
| 140 | 139 | $this->baseLocation, |
| 141 | 140 | $driverBase, |
@@ -96,6 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Analisa os caminhos das pastas base |
| 99 | + * @param string $basePath |
|
| 99 | 100 | */ |
| 100 | 101 | public function parseLocation ( $basePath ) |
| 101 | 102 | { |
@@ -269,6 +270,7 @@ discard block |
||
| 269 | 270 | * parse a tpl file and return the result |
| 270 | 271 | * |
| 271 | 272 | * @param String $tplFile |
| 273 | + * @param AbstractAdapter $objMakeFile |
|
| 272 | 274 | * |
| 273 | 275 | * @return String |
| 274 | 276 | */ |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | foreach ( $arrFoldersName as $index => $folderName ) { |
| 90 | 90 | $arrFoldersName[ $index ] = $this->getConfig () |
| 91 | - ->replaceReservedWord ( $folderName ); |
|
| 91 | + ->replaceReservedWord ( $folderName ); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) ); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $folderName, |
| 142 | 142 | $this->getClassName ( |
| 143 | 143 | $this->getConfig () |
| 144 | - ->getDatabase () |
|
| 144 | + ->getDatabase () |
|
| 145 | 145 | ) |
| 146 | 146 | ); |
| 147 | 147 | $this->location = array ( $this->filterLocation ( $url ) ); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @return String |
| 274 | 274 | */ |
| 275 | 275 | protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null, |
| 276 | - $objMakeFile = null ) |
|
| 276 | + $objMakeFile = null ) |
|
| 277 | 277 | { |
| 278 | 278 | |
| 279 | 279 | $arrUrl = array ( |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @type string[] |
| 20 | 20 | */ |
| 21 | - public $location = array (); |
|
| 21 | + public $location = array(); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * caminho de pastas Base |
@@ -39,42 +39,42 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | private $msgReservedWord = "\033[0mPlease enter the value for reserved word \033[0;31m'%index%' \033[1;33m[%config%]:\033[0m "; |
| 41 | 41 | |
| 42 | - public function __construct ( Config $config ) |
|
| 42 | + public function __construct(Config $config) |
|
| 43 | 43 | { |
| 44 | - $this->config = $config->getAdapterConfig (); |
|
| 45 | - $this->parseReservedWord ( $this->getConfig () ); |
|
| 46 | - $this->driver = $config->getAdapterDriver ( $this->getConfig () ); |
|
| 47 | - $this->parseLocation ( $config->_basePath ); |
|
| 44 | + $this->config = $config->getAdapterConfig(); |
|
| 45 | + $this->parseReservedWord($this->getConfig()); |
|
| 46 | + $this->driver = $config->getAdapterDriver($this->getConfig()); |
|
| 47 | + $this->parseLocation($config->_basePath); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * @param AdapterConfig\AbstractAdapter $config |
| 52 | 52 | */ |
| 53 | - public function parseReservedWord ( AdapterConfig\AbstractAdapter $config ) |
|
| 53 | + public function parseReservedWord(AdapterConfig\AbstractAdapter $config) |
|
| 54 | 54 | { |
| 55 | 55 | $palavrasReservadas = $config->reservedWord; |
| 56 | - if ( !$palavrasReservadas ) { |
|
| 56 | + if ( ! $palavrasReservadas) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $schema = $config->getSchemas (); |
|
| 61 | - $db = $config->getDatabase (); |
|
| 62 | - $hasSchema = array_intersect ( $schema, array_flip ( $palavrasReservadas ) ); |
|
| 63 | - $hasDatabase = in_array ( $db, $palavrasReservadas ); |
|
| 64 | - if ( !( $hasSchema or $hasDatabase ) ) { |
|
| 60 | + $schema = $config->getSchemas(); |
|
| 61 | + $db = $config->getDatabase(); |
|
| 62 | + $hasSchema = array_intersect($schema, array_flip($palavrasReservadas)); |
|
| 63 | + $hasDatabase = in_array($db, $palavrasReservadas); |
|
| 64 | + if ( ! ($hasSchema or $hasDatabase)) { |
|
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | echo "- database has reserved words\n"; |
| 69 | - foreach ( $palavrasReservadas as $index => $config ) { |
|
| 70 | - $attribs = array ( |
|
| 69 | + foreach ($palavrasReservadas as $index => $config) { |
|
| 70 | + $attribs = array( |
|
| 71 | 71 | "%index%" => $index, |
| 72 | 72 | "%config%" => $config |
| 73 | 73 | ); |
| 74 | - echo strtr ( $this->msgReservedWord, $attribs ); |
|
| 75 | - $line = trim ( fgets ( STDIN ) ); |
|
| 76 | - if ( !empty( $line ) ) { |
|
| 77 | - $this->getConfig ()->reservedWord[ $index ] = $line; |
|
| 74 | + echo strtr($this->msgReservedWord, $attribs); |
|
| 75 | + $line = trim(fgets(STDIN)); |
|
| 76 | + if ( ! empty($line)) { |
|
| 77 | + $this->getConfig()->reservedWord[$index] = $line; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -84,155 +84,155 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - private function filterLocation ( $arrFoldersName ) |
|
| 87 | + private function filterLocation($arrFoldersName) |
|
| 88 | 88 | { |
| 89 | - foreach ( $arrFoldersName as $index => $folderName ) { |
|
| 90 | - $arrFoldersName[ $index ] = $this->getConfig () |
|
| 91 | - ->replaceReservedWord ( $folderName ); |
|
| 89 | + foreach ($arrFoldersName as $index => $folderName) { |
|
| 90 | + $arrFoldersName[$index] = $this->getConfig() |
|
| 91 | + ->replaceReservedWord($folderName); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) ); |
|
| 94 | + return implode(DIRECTORY_SEPARATOR, array_filter($arrFoldersName)); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Analisa os caminhos das pastas base |
| 99 | 99 | */ |
| 100 | - public function parseLocation ( $basePath ) |
|
| 100 | + public function parseLocation($basePath) |
|
| 101 | 101 | { |
| 102 | 102 | |
| 103 | - $arrBase = array ( |
|
| 103 | + $arrBase = array( |
|
| 104 | 104 | $basePath, |
| 105 | 105 | $this->config->path |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - $this->baseLocation = $this->filterLocation ( $arrBase ); |
|
| 108 | + $this->baseLocation = $this->filterLocation($arrBase); |
|
| 109 | 109 | |
| 110 | 110 | # pasta com nome do driver do banco |
| 111 | 111 | $driverBase = ''; |
| 112 | - if ( (bool) @$this->config->{"folder-database"} ) { |
|
| 113 | - $classDriver = explode ( '\\', get_class ( $this->driver ) ); |
|
| 114 | - $driverBase = end ( $classDriver ); |
|
| 112 | + if ((bool) @$this->config->{"folder-database"} ) { |
|
| 113 | + $classDriver = explode('\\', get_class($this->driver)); |
|
| 114 | + $driverBase = end($classDriver); |
|
| 115 | 115 | } |
| 116 | 116 | $folderName = ''; |
| 117 | - if ( (bool) @$this->config->{"folder-name"} ) { |
|
| 118 | - $folderName = $this->getClassName ( trim ( $this->config->{"folder-name"} ) ); |
|
| 117 | + if ((bool) @$this->config->{"folder-name"} ) { |
|
| 118 | + $folderName = $this->getClassName(trim($this->config->{"folder-name"} )); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if ( $this->config->hasSchemas () ) { |
|
| 121 | + if ($this->config->hasSchemas()) { |
|
| 122 | 122 | |
| 123 | - $schemas = $this->config->getSchemas (); |
|
| 124 | - foreach ( $schemas as $schema ) { |
|
| 125 | - $arrUrl = array ( |
|
| 123 | + $schemas = $this->config->getSchemas(); |
|
| 124 | + foreach ($schemas as $schema) { |
|
| 125 | + $arrUrl = array( |
|
| 126 | 126 | $this->baseLocation, |
| 127 | 127 | $driverBase, |
| 128 | 128 | $folderName, |
| 129 | - $this->getClassName ( $schema ) |
|
| 129 | + $this->getClassName($schema) |
|
| 130 | 130 | ); |
| 131 | 131 | |
| 132 | - $this->location[ $schema ] = $this->filterLocation ( $arrUrl ); |
|
| 133 | - unset( $arrUrl ); |
|
| 132 | + $this->location[$schema] = $this->filterLocation($arrUrl); |
|
| 133 | + unset($arrUrl); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | } |
| 137 | 137 | else { |
| 138 | - $url = array ( |
|
| 138 | + $url = array( |
|
| 139 | 139 | $this->baseLocation, |
| 140 | 140 | $driverBase, |
| 141 | 141 | $folderName, |
| 142 | - $this->getClassName ( |
|
| 143 | - $this->getConfig () |
|
| 144 | - ->getDatabase () |
|
| 142 | + $this->getClassName( |
|
| 143 | + $this->getConfig() |
|
| 144 | + ->getDatabase() |
|
| 145 | 145 | ) |
| 146 | 146 | ); |
| 147 | - $this->location = array ( $this->filterLocation ( $url ) ); |
|
| 148 | - unset( $url ); |
|
| 147 | + $this->location = array($this->filterLocation($url)); |
|
| 148 | + unset($url); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * @return AdapterConfig\AbstractAdapter |
| 154 | 154 | */ |
| 155 | - public function getConfig () |
|
| 155 | + public function getConfig() |
|
| 156 | 156 | { |
| 157 | 157 | return $this->config; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /* Get current time */ |
| 161 | - public function startTime () |
|
| 161 | + public function startTime() |
|
| 162 | 162 | { |
| 163 | 163 | echo "Starting..\n"; |
| 164 | - $this->startTime = microtime ( true ); |
|
| 164 | + $this->startTime = microtime(true); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - private function getRunTime () |
|
| 167 | + private function getRunTime() |
|
| 168 | 168 | { |
| 169 | - return round ( ( microtime ( true ) - $this->startTime ), 3 ); |
|
| 169 | + return round((microtime(true) - $this->startTime), 3); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * Executa o Make, criando arquivos e Diretorios |
| 174 | 174 | */ |
| 175 | - public function run () |
|
| 175 | + public function run() |
|
| 176 | 176 | { |
| 177 | - $this->startTime (); |
|
| 178 | - $this->driver->runDatabase (); |
|
| 179 | - $this->max = $this->driver->getTotalTables () * $this->countDiretory (); |
|
| 177 | + $this->startTime(); |
|
| 178 | + $this->driver->runDatabase(); |
|
| 179 | + $this->max = $this->driver->getTotalTables() * $this->countDiretory(); |
|
| 180 | 180 | $cur = 0; |
| 181 | 181 | |
| 182 | 182 | |
| 183 | - foreach ( $this->location as $schema => $location ) { |
|
| 184 | - foreach ( $this->factoryMakerFile () as $objMakeFile ) { |
|
| 185 | - $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName (); |
|
| 186 | - self::makeDir ( $path ); |
|
| 187 | - if ( $objMakeFile->getParentFileTpl () != '' ) { |
|
| 183 | + foreach ($this->location as $schema => $location) { |
|
| 184 | + foreach ($this->factoryMakerFile() as $objMakeFile) { |
|
| 185 | + $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName(); |
|
| 186 | + self::makeDir($path); |
|
| 187 | + if ($objMakeFile->getParentFileTpl() != '') { |
|
| 188 | 188 | $fileAbstract = $this->baseLocation |
| 189 | 189 | . DIRECTORY_SEPARATOR |
| 190 | - . $objMakeFile->getParentClass () |
|
| 190 | + . $objMakeFile->getParentClass() |
|
| 191 | 191 | . '.php'; |
| 192 | 192 | |
| 193 | - $tplAbstract = $this->getParsedTplContents ( $objMakeFile->getParentFileTpl () ); |
|
| 194 | - self::makeSourcer ( $fileAbstract, $tplAbstract, true ); |
|
| 195 | - unset( $fileAbstract, $tplAbstract ); |
|
| 193 | + $tplAbstract = $this->getParsedTplContents($objMakeFile->getParentFileTpl()); |
|
| 194 | + self::makeSourcer($fileAbstract, $tplAbstract, true); |
|
| 195 | + unset($fileAbstract, $tplAbstract); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | - foreach ( $this->driver->getTables ( $schema ) as $key => $objTables ) { |
|
| 199 | - $file = $path . DIRECTORY_SEPARATOR . self::getClassName ( $objTables->getName () ) . '.php'; |
|
| 198 | + foreach ($this->driver->getTables($schema) as $key => $objTables) { |
|
| 199 | + $file = $path . DIRECTORY_SEPARATOR . self::getClassName($objTables->getName()) . '.php'; |
|
| 200 | 200 | |
| 201 | - $tpl = $this->getParsedTplContents ( |
|
| 202 | - $objMakeFile->getFileTpl (), |
|
| 203 | - $objMakeFile->parseRelation ( $this, $objTables ), |
|
| 201 | + $tpl = $this->getParsedTplContents( |
|
| 202 | + $objMakeFile->getFileTpl(), |
|
| 203 | + $objMakeFile->parseRelation($this, $objTables), |
|
| 204 | 204 | $objTables, |
| 205 | 205 | $objMakeFile |
| 206 | 206 | |
| 207 | 207 | ); |
| 208 | - self::makeSourcer ( $file, $tpl, $objMakeFile->isOverwrite () ); |
|
| 209 | - $this->countCreatedFiles ( $cur ); |
|
| 208 | + self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite()); |
|
| 209 | + $this->countCreatedFiles($cur); |
|
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $this->reportProcess ( $cur ); |
|
| 214 | + $this->reportProcess($cur); |
|
| 215 | 215 | echo "\n\033[1;32mSuccessfully process finished!\n\033[0m"; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - private function countCreatedFiles ( &$cur ) |
|
| 218 | + private function countCreatedFiles(&$cur) |
|
| 219 | 219 | { |
| 220 | 220 | ++$cur; |
| 221 | - $total = ( $cur / $this->max ) * 100; |
|
| 222 | - printf ( "\r Creating: %6.2f%%", $total ); |
|
| 221 | + $total = ($cur / $this->max) * 100; |
|
| 222 | + printf("\r Creating: %6.2f%%", $total); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - private function reportProcess ( $countFiles ) |
|
| 225 | + private function reportProcess($countFiles) |
|
| 226 | 226 | { |
| 227 | - if ( $this->config->isStatusEnabled () ) { |
|
| 228 | - $databases = count ( $this->location ); |
|
| 229 | - $countDir = $this->countDiretory (); |
|
| 230 | - $totalTable = $this->driver->getTotalTables (); |
|
| 227 | + if ($this->config->isStatusEnabled()) { |
|
| 228 | + $databases = count($this->location); |
|
| 229 | + $countDir = $this->countDiretory(); |
|
| 230 | + $totalTable = $this->driver->getTotalTables(); |
|
| 231 | 231 | echo "\n------"; |
| 232 | - printf ( "\n\r-Files generated:%s of %s", $countFiles, $this->max ); |
|
| 233 | - printf ( "\n\r-Diretory generated:%s", $databases * $countDir ); |
|
| 234 | - printf ( "\n\r-Scanned tables:%s", $totalTable ); |
|
| 235 | - printf ( "\n\r-Execution time: %ssec", $this->getRunTime () ); |
|
| 232 | + printf("\n\r-Files generated:%s of %s", $countFiles, $this->max); |
|
| 233 | + printf("\n\r-Diretory generated:%s", $databases * $countDir); |
|
| 234 | + printf("\n\r-Scanned tables:%s", $totalTable); |
|
| 235 | + printf("\n\r-Execution time: %ssec", $this->getRunTime()); |
|
| 236 | 236 | echo "\n------"; |
| 237 | 237 | } |
| 238 | 238 | } |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | * |
| 243 | 243 | * @return AbstractAdapter[] |
| 244 | 244 | */ |
| 245 | - public function factoryMakerFile () |
|
| 245 | + public function factoryMakerFile() |
|
| 246 | 246 | { |
| 247 | - return $this->config->getMakeFileInstances (); |
|
| 247 | + return $this->config->getMakeFileInstances(); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | /** |
@@ -252,11 +252,11 @@ discard block |
||
| 252 | 252 | * |
| 253 | 253 | * @return int |
| 254 | 254 | */ |
| 255 | - public function countDiretory () |
|
| 255 | + public function countDiretory() |
|
| 256 | 256 | { |
| 257 | 257 | $dir = 1; |
| 258 | - foreach ( $this->factoryMakerFile () as $abstractAdapter ) { |
|
| 259 | - if ( $abstractAdapter->hasDiretory () ) { |
|
| 258 | + foreach ($this->factoryMakerFile() as $abstractAdapter) { |
|
| 259 | + if ($abstractAdapter->hasDiretory()) { |
|
| 260 | 260 | ++$dir; |
| 261 | 261 | } |
| 262 | 262 | } |
@@ -272,24 +272,24 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @return String |
| 274 | 274 | */ |
| 275 | - protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null, |
|
| 276 | - $objMakeFile = null ) |
|
| 275 | + protected function getParsedTplContents($tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null, |
|
| 276 | + $objMakeFile = null) |
|
| 277 | 277 | { |
| 278 | 278 | |
| 279 | - $arrUrl = array ( |
|
| 279 | + $arrUrl = array( |
|
| 280 | 280 | __DIR__, |
| 281 | 281 | 'templates', |
| 282 | 282 | $this->config->framework, |
| 283 | 283 | $tplFile |
| 284 | 284 | ); |
| 285 | 285 | |
| 286 | - $filePath = implode ( DIRECTORY_SEPARATOR, filter_var_array ( $arrUrl ) ); |
|
| 286 | + $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl)); |
|
| 287 | 287 | |
| 288 | - extract ( $vars ); |
|
| 289 | - ob_start (); |
|
| 288 | + extract($vars); |
|
| 289 | + ob_start(); |
|
| 290 | 290 | require $filePath; |
| 291 | - $data = ob_get_contents (); |
|
| 292 | - ob_end_clean (); |
|
| 291 | + $data = ob_get_contents(); |
|
| 292 | + ob_end_clean(); |
|
| 293 | 293 | |
| 294 | 294 | return $data; |
| 295 | 295 | } |
@@ -3,22 +3,22 @@ |
||
| 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 | - * @see <?=$objTables->getNamespace()?>\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
| 8 | + * @see <?=$objTables->getNamespace()?>\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
| 9 | 9 | * |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | namespace <?=$objTables->getNamespace()?>; |
| 20 | 20 | |
| 21 | -class <?=$this->getClassName ( $objTables->getName () )?> extends \<?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
| 21 | +class <?=$this->getClassName($objTables->getName())?> extends \<?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
| 22 | 22 | { |
| 23 | 23 | /* @TODO Codifique aqui */ |
| 24 | 24 | } |
@@ -3,28 +3,28 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Mvc Model |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$objTables->getNamespace()?>\Peer |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | namespace <?=$objTables->getNamespace()?>\Peer; |
| 19 | 19 | |
| 20 | -class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends \<?=$this->config->namespace?$this->config->namespace."\\":""?>Models\<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 20 | +class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends \<?=$this->config->namespace ? $this->config->namespace . "\\" : ""?>Models\<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | 23 | * Name of the object for static instance |
| 24 | 24 | * |
| 25 | 25 | * @var string $className |
| 26 | 26 | */ |
| 27 | - protected static $className = '<?=$objTables->getNamespace()?>\<?=$this->getClassName ( $objTables->getName () )?>'; |
|
| 27 | + protected static $className = '<?=$objTables->getNamespace()?>\<?=$this->getClassName($objTables->getName())?>'; |
|
| 28 | 28 | |
| 29 | 29 | /* @TODO Codifique aqui */ |
| 30 | 30 | } |
| 31 | 31 | \ No newline at end of file |
@@ -3,19 +3,19 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Mvc Model |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$this->config->namespace?>\Models |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -namespace <?=$this->config->namespace?$this->config->namespace."\\":""?>Models; |
|
| 18 | +namespace <?=$this->config->namespace ? $this->config->namespace . "\\" : ""?>Models; |
|
| 19 | 19 | |
| 20 | 20 | abstract class AbstractPeer |
| 21 | 21 | { |
@@ -3,20 +3,20 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Data Entity 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()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>. <?="\n"?> |
|
| 9 | + * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::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"?> |
|
| 16 | - * @version <?=$this->config->version."\n"?> |
|
| 13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 14 | + * @license <?=$this->config->license . "\n"?> |
|
| 15 | + * @link <?=$this->config->link . "\n"?> |
|
| 16 | + * @version <?=$this->config->version . "\n"?> |
|
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
| 19 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
| 20 | 20 | { |
| 21 | 21 | /* @TODO Codifique aqui */ |
| 22 | 22 | } |
@@ -3,18 +3,18 @@ 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 | * Classe Abstract pai de todas as tabelas |
| 9 | 9 | * |
| 10 | 10 | * @package <?=$this->config->namespace?>Model |
| 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"?> |
|
| 17 | - * @version <?=$this->config->version."\n"?> |
|
| 14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 15 | + * @license <?=$this->config->license . "\n"?> |
|
| 16 | + * @link <?=$this->config->link . "\n"?> |
|
| 17 | + * @version <?=$this->config->version . "\n"?> |
|
| 18 | 18 | * |
| 19 | 19 | * @abstract |
| 20 | 20 | */ |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * Zend DB Table Abstract class |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | -abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
| 26 | +abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
| 27 | 27 | { |
| 28 | 28 | /** |
| 29 | 29 | * Nome da tabela do banco de dados |
@@ -3,21 +3,21 @@ 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"?> |
|
| 17 | - * @version <?=$this->config->version."\n"?> |
|
| 14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 15 | + * @license <?=$this->config->license . "\n"?> |
|
| 16 | + * @link <?=$this->config->link . "\n"?> |
|
| 17 | + * @version <?=$this->config->version . "\n"?> |
|
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | -class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$this->config->namespace?$this->config->namespace."_":""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 20 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
| 21 | 21 | { |
| 22 | 22 | /** |
| 23 | 23 | * Nome da tabela do banco de dados |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @access protected |
| 27 | 27 | */ |
| 28 | 28 | protected $_name = '<?=$objTables->getName()?>'; |
| 29 | -<?php if($objTables->hasSchema()): ?> |
|
| 29 | +<?php if ($objTables->hasSchema()): ?> |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Schema da tabela do banco de dados |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * @var string |
| 44 | 44 | * @access protected |
| 45 | 45 | */ |
| 46 | - protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
| 46 | + protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
| 47 | 47 | |
| 48 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
| 48 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
| 49 | 49 | /** |
| 50 | 50 | * Nome da Primary Key |
| 51 | 51 | * |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @access protected |
| 54 | 54 | */ |
| 55 | 55 | protected $_primary = array( |
| 56 | -<?php foreach($objTables->getPrimaryKeys() as $pks):?> |
|
| 56 | +<?php foreach ($objTables->getPrimaryKeys() as $pks):?> |
|
| 57 | 57 | '<?=$pks->getName()?>', |
| 58 | 58 | <?php endforeach; ?> |
| 59 | 59 | ); |
| 60 | 60 | <?php endif ?> |
| 61 | -<?php if($this->config->{'folder-name'}):?> |
|
| 61 | +<?php if ($this->config->{'folder-name'}):?> |
|
| 62 | 62 | /** |
| 63 | 63 | * Initialize database adapter. |
| 64 | 64 | * |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | parent::_setupDatabaseAdapter(); |
| 74 | 74 | } |
| 75 | 75 | <?php endif ?> |
| 76 | -<?php if( $objTables->hasSequences() ) : ?> |
|
| 76 | +<?php if ($objTables->hasSequences()) : ?> |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Definir a lógica para os novos valores na chave primária. |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @var mixed |
| 83 | 83 | */ |
| 84 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
| 85 | -<?php if(strpos($this->config->driver, 'pgsql')): ?> |
|
| 86 | -<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
| 84 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
| 85 | +<?php if (strpos($this->config->driver, 'pgsql')): ?> |
|
| 86 | +<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
| 87 | 87 | protected $_sequence = '<?=$seq->getSequence() ?>'; |
| 88 | 88 | <?php else: ?> |
| 89 | 89 | protected $_sequence = true; |
@@ -3,19 +3,19 @@ discard block |
||
| 3 | 3 | /** |
| 4 | 4 | * Application Entity |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$this->config->namespace?>Model |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 15 | - * @version <?=$this->config->version."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | + * @version <?=$this->config->version . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
|
| 18 | +abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
|
| 19 | 19 | { |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @param array $data |
| 78 | - * @return <?=$this->config->namespace?$this->config->namespace."_":""?>>Model_EntityAbstract |
|
| 78 | + * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>>Model_EntityAbstract |
|
| 79 | 79 | */ |
| 80 | 80 | public static function getIntance($data = array()) |
| 81 | 81 | { |