@@ -140,9 +140,12 @@ discard block |
||
140 | 140 | * Stored in ISO 8601 format. |
141 | 141 | * |
142 | 142 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
143 | -<?php else: ?> |
|
143 | +<?php else { |
|
144 | + : ?> |
|
144 | 145 | * @param <?=$column->getType()?> $<?=$column->getName() . "\n"?> |
145 | -<?php endif; ?> |
|
146 | +<?php endif; |
|
147 | +} |
|
148 | +?> |
|
146 | 149 | * @return <?=$className . "\n"?> |
147 | 150 | */ |
148 | 151 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
@@ -189,9 +192,12 @@ discard block |
||
189 | 192 | <?php if ($column->getType()=='date'): ?> |
190 | 193 | * @param boolean $returnZendDate |
191 | 194 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
192 | -<?php else: ?> |
|
195 | +<?php else { |
|
196 | + : ?> |
|
193 | 197 | * @return <?=$column->getType() . "\n"?> |
194 | -<?php endif; ?> |
|
198 | +<?php endif; |
|
199 | +} |
|
200 | +?> |
|
195 | 201 | */ |
196 | 202 | public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
197 | 203 | { |
@@ -1,35 +1,35 @@ discard block |
||
1 | 1 | <?="<?php\n"?> |
2 | -<?php $className = $objTables->getNamespace(). '_Entity_' . \Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> |
|
2 | +<?php $className = $objTables->getNamespace() . '_Entity_' . \Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Application Entity |
6 | 6 | * |
7 | - * <?=$this->config->last_modify."\n"?> |
|
7 | + * <?=$this->config->last_modify . "\n"?> |
|
8 | 8 | * |
9 | - * @package <?=$objTables->getNamespace()."\n"?> |
|
9 | + * @package <?=$objTables->getNamespace() . "\n"?> |
|
10 | 10 | * @subpackage Entity |
11 | 11 | * |
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 | 19 | /** |
20 | 20 | * Abstract class for entity |
21 | 21 | */ |
22 | 22 | |
23 | -abstract class <?=$className?> extends <?=$this->config->namespace?$this->config->namespace."_":""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
23 | +abstract class <?=$className?> extends <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
24 | 24 | { |
25 | 25 | |
26 | 26 | <?php foreach ($objTables->getColumns() as $column): ?> |
27 | 27 | /** |
28 | - * Database constraint in the column <?=$column->getName()."\n"?> |
|
28 | + * Database constraint in the column <?=$column->getName() . "\n"?> |
|
29 | 29 | * |
30 | 30 | */ |
31 | 31 | const <?=strtoupper($column->getName())?> = '<?=$objTables->getName()?>.<?=$column->getName()?>'; |
32 | -<?php endforeach;?> |
|
32 | +<?php endforeach; ?> |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Nome da tabela DbTable do model |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @var string |
38 | 38 | * @access protected |
39 | 39 | */ |
40 | - protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
40 | + protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_columnsList |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | protected $_columnsList = array( |
46 | 46 | <?php foreach ($objTables->getColumns() as $column): ?> |
47 | 47 | self::<?=strtoupper($column->getName())?> => '<?=strtolower(\Classes\Maker\AbstractMaker::getClassName($column->getName()))?>', |
48 | -<?php endforeach;?> |
|
48 | +<?php endforeach; ?> |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_filters |
53 | 53 | */ |
54 | 54 | protected $_filters = array( |
55 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
55 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
56 | 56 | <?php |
57 | 57 | $filters = null; |
58 | - switch ( ucfirst ( $column->getType () ) ) |
|
58 | + switch (ucfirst($column->getType())) |
|
59 | 59 | { |
60 | 60 | case 'String': |
61 | 61 | $filters = 'StripTags", "StringTrim'; |
@@ -66,50 +66,50 @@ discard block |
||
66 | 66 | case 'Date': |
67 | 67 | break; |
68 | 68 | default: |
69 | - $filters = ucfirst ( $column->getType () ); |
|
69 | + $filters = ucfirst($column->getType()); |
|
70 | 70 | break; |
71 | 71 | } |
72 | 72 | ?> |
73 | 73 | '<?=$column->getName()?>'=>array ( |
74 | - <?=( !empty( $filters ) ) ? "\"{$filters}\"\n" : null; ?> |
|
74 | + <?=( ! empty($filters)) ? "\"{$filters}\"\n" : null; ?> |
|
75 | 75 | ), |
76 | -<?php endforeach;?> |
|
76 | +<?php endforeach; ?> |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_validators |
81 | 81 | */ |
82 | 82 | protected $_validators= array( |
83 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
83 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
84 | 84 | <?php |
85 | - $validators = array (); |
|
85 | + $validators = array(); |
|
86 | 86 | |
87 | - $validators[] = $column->isNullable () ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
87 | + $validators[] = $column->isNullable() ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
88 | 88 | |
89 | - switch ( ucfirst ( $column->getType () ) ) |
|
89 | + switch (ucfirst($column->getType())) |
|
90 | 90 | { |
91 | 91 | case 'String': |
92 | - if ( $column->getMaxLength () ) |
|
92 | + if ($column->getMaxLength()) |
|
93 | 93 | { |
94 | - $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength () . " ) )"; |
|
94 | + $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength() . " ) )"; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | break; |
98 | 98 | case 'Boolean': |
99 | 99 | break; |
100 | 100 | default: |
101 | - $name = ucfirst ( $column->getType () ); |
|
101 | + $name = ucfirst($column->getType()); |
|
102 | 102 | $validators[] = "'$name'"; |
103 | 103 | break; |
104 | 104 | } |
105 | - $validators = implode ( ", ", $validators )?> |
|
106 | - '<?= $column->getName () ?>' => array ( |
|
107 | - <?=( !empty( $validators ) ) ? "{$validators}\n" : null?> |
|
105 | + $validators = implode(", ", $validators)?> |
|
106 | + '<?= $column->getName() ?>' => array ( |
|
107 | + <?=( ! empty($validators)) ? "{$validators}\n" : null?> |
|
108 | 108 | ), |
109 | 109 | <?php endforeach; ?> |
110 | 110 | ); |
111 | 111 | |
112 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
112 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
113 | 113 | /** |
114 | 114 | * Nome da Primary Key |
115 | 115 | * |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | |
120 | 120 | protected $_primary = array( |
121 | - <?php foreach($objTables->getPrimarykeys() as $pks) : ?> |
|
121 | + <?php foreach ($objTables->getPrimarykeys() as $pks) : ?> |
|
122 | 122 | '<?=$pks->getName()?>', |
123 | 123 | <?php endforeach ?> |
124 | 124 | ); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | protected $_parent_<?=$parent['name']?>; |
134 | 134 | |
135 | -<?php endforeach;?> |
|
135 | +<?php endforeach; ?> |
|
136 | 136 | <?php foreach ($depends as $depend): ?> |
137 | 137 | /** |
138 | 138 | * Depends relation <?=\Classes\Maker\AbstractMaker::getClassName($depend['table']) . "\n"?> |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | */ |
142 | 142 | protected $_depend_<?=$depend['name']?>; |
143 | 143 | |
144 | -<?php endforeach;?> |
|
144 | +<?php endforeach; ?> |
|
145 | 145 | <?php foreach ($objTables->getColumns() as $column): ?> |
146 | 146 | /** |
147 | 147 | * |
148 | - * Sets column <?=$column->getName()."\n"?> |
|
148 | + * Sets column <?=$column->getName() . "\n"?> |
|
149 | 149 | * |
150 | -<?php if ($column->getType()=='date'): ?> |
|
150 | +<?php if ($column->getType() == 'date'): ?> |
|
151 | 151 | * Stored in ISO 8601 format. |
152 | 152 | * |
153 | 153 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
160 | 160 | { |
161 | -<?php switch ( $column->getType () ): |
|
161 | +<?php switch ($column->getType()): |
|
162 | 162 | case 'date': ?> |
163 | 163 | if (! empty($<?=$column->getName()?>)) |
164 | 164 | { |
@@ -197,16 +197,16 @@ discard block |
||
197 | 197 | /** |
198 | 198 | * Gets column <?=$column->getName() . "\n"?> |
199 | 199 | * |
200 | -<?php if ($column->getType()=='date'): ?> |
|
200 | +<?php if ($column->getType() == 'date'): ?> |
|
201 | 201 | * @param boolean $returnZendDate |
202 | 202 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
203 | 203 | <?php else: ?> |
204 | 204 | * @return <?=$column->getType() . "\n"?> |
205 | 205 | <?php endif; ?> |
206 | 206 | */ |
207 | - public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
|
207 | + public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType() == 'date'): ?>$returnZendDate = false <?php endif; ?>) |
|
208 | 208 | { |
209 | -<?php if ($column->getType()=='date'): ?> |
|
209 | +<?php if ($column->getType() == 'date'): ?> |
|
210 | 210 | if ($returnZendDate) |
211 | 211 | { |
212 | 212 | if ($this->_data['<?=$column->getName()?>'] === null) |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | { |
233 | 233 | if ($this->_parent_<?=$parent['name']?> === null) |
234 | 234 | { |
235 | - $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
235 | + $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | return $this->_parent_<?=$parent['name']?>; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | { |
252 | 252 | if ($this->_depend_<?=$depend['name']?> === null) |
253 | 253 | { |
254 | - $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($depend['table'])?>'); |
|
254 | + $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($depend['table'])?>'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return $this->_depend_<?=$depend['name']?>; |
@@ -3,19 +3,19 @@ |
||
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"?> |
|
13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
14 | + * @license <?=$this->config->license . "\n"?> |
|
15 | + * @link <?=$this->config->link . "\n"?> |
|
16 | 16 | */ |
17 | 17 | |
18 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | protected $fileTpl = "entity.php"; |
23 | 23 | protected $overwrite = true; |
24 | 24 | |
25 | - protected $validFunc = array (); |
|
25 | + protected $validFunc = array(); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param \Classes\MakerFile $makerFile |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
33 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
34 | 34 | { |
35 | - return array ( |
|
36 | - 'parents' => $this->listParents ( $makerFile , $dbTable ) , |
|
37 | - 'depends' => $this->listDependence ( $makerFile , $dbTable ) |
|
35 | + return array( |
|
36 | + 'parents' => $this->listParents($makerFile, $dbTable), |
|
37 | + 'depends' => $this->listDependence($makerFile, $dbTable) |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array |
46 | 46 | */ |
47 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
47 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
48 | 48 | { |
49 | - $parents = array (); |
|
50 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
49 | + $parents = array(); |
|
50 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
51 | 51 | { |
52 | - $constrant = $objColumn->getFks (); |
|
52 | + $constrant = $objColumn->getFks(); |
|
53 | 53 | $name = |
54 | 54 | 'Parent' |
55 | 55 | . ZendFrameworkOne::SEPARETOR |
56 | - . AbstractMaker::getClassName ( $constrant->getTable () ) |
|
56 | + . AbstractMaker::getClassName($constrant->getTable()) |
|
57 | 57 | . ZendFrameworkOne::SEPARETOR |
58 | 58 | . 'By' |
59 | 59 | . ZendFrameworkOne::SEPARETOR |
60 | - . $objColumn->getName (); |
|
60 | + . $objColumn->getName(); |
|
61 | 61 | |
62 | - $arrClass = array ( |
|
63 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ), |
|
64 | - AbstractMaker::getClassName ( $constrant->getTable () ) |
|
62 | + $arrClass = array( |
|
63 | + $makerFile->getConfig()->createClassNamespace($constrant), |
|
64 | + AbstractMaker::getClassName($constrant->getTable()) |
|
65 | 65 | ); |
66 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
66 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
67 | 67 | |
68 | - $parents[] = array ( |
|
69 | - 'class' => $class , |
|
70 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
71 | - 'table' => $constrant->getTable () , |
|
72 | - 'column' => $objColumn->getName () , |
|
73 | - 'name' => $constrant->getNameConstrant () , |
|
68 | + $parents[] = array( |
|
69 | + 'class' => $class, |
|
70 | + 'function' => AbstractMaker::getClassName($name), |
|
71 | + 'table' => $constrant->getTable(), |
|
72 | + 'column' => $objColumn->getName(), |
|
73 | + 'name' => $constrant->getNameConstrant(), |
|
74 | 74 | ); |
75 | - unset( $name ); |
|
75 | + unset($name); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | return $parents; |
@@ -84,40 +84,40 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return array |
86 | 86 | */ |
87 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
87 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
88 | 88 | { |
89 | - $depends = array (); |
|
90 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
89 | + $depends = array(); |
|
90 | + foreach ($dbTable->getDependences() as $objColumn) |
|
91 | 91 | { |
92 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
92 | + foreach ($objColumn->getDependences() as $dependence) |
|
93 | 93 | { |
94 | 94 | $name = |
95 | 95 | 'Depend' |
96 | 96 | . ZendFrameworkOne::SEPARETOR |
97 | - . AbstractMaker::getClassName ( $dependence->getTable () ) |
|
97 | + . AbstractMaker::getClassName($dependence->getTable()) |
|
98 | 98 | . ZendFrameworkOne::SEPARETOR |
99 | 99 | . 'By' |
100 | 100 | . ZendFrameworkOne::SEPARETOR |
101 | - . $objColumn->getName (); |
|
101 | + . $objColumn->getName(); |
|
102 | 102 | |
103 | - if ( ! key_exists ( $name , $this->validFunc ) ) |
|
103 | + if ( ! key_exists($name, $this->validFunc)) |
|
104 | 104 | { |
105 | - $arrClass = array ( |
|
106 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ), |
|
107 | - AbstractMaker::getClassName ( $dependence->getTable () ) |
|
105 | + $arrClass = array( |
|
106 | + $makerFile->getConfig()->createClassNamespace($dependence), |
|
107 | + AbstractMaker::getClassName($dependence->getTable()) |
|
108 | 108 | ); |
109 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
109 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
110 | 110 | |
111 | - $this->validFunc[ $name ] = true; |
|
112 | - $depends[] = array ( |
|
111 | + $this->validFunc[$name] = true; |
|
112 | + $depends[] = array( |
|
113 | 113 | 'class' => $class, |
114 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
115 | - 'table' => $dependence->getTable () , |
|
116 | - 'column' => $dependence->getColumn () , |
|
117 | - 'name' => $dependence->getNameConstrant () |
|
114 | + 'function' => AbstractMaker::getClassName($name), |
|
115 | + 'table' => $dependence->getTable(), |
|
116 | + 'column' => $dependence->getColumn(), |
|
117 | + 'name' => $dependence->getNameConstrant() |
|
118 | 118 | ); |
119 | 119 | } |
120 | - unset( $name ); |
|
120 | + unset($name); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |
@@ -28,67 +28,67 @@ |
||
28 | 28 | * |
29 | 29 | * @return array |
30 | 30 | */ |
31 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
31 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
32 | 32 | { |
33 | 33 | $referenceMap = ''; |
34 | - $references = array (); |
|
34 | + $references = array(); |
|
35 | 35 | $dependentTables = ''; |
36 | - $dependents = array (); |
|
37 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
36 | + $dependents = array(); |
|
37 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
38 | 38 | { |
39 | - $constrant = $objColumn->getFks (); |
|
39 | + $constrant = $objColumn->getFks(); |
|
40 | 40 | |
41 | - $arrClass = array ( |
|
42 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ), |
|
41 | + $arrClass = array( |
|
42 | + $makerFile->getConfig()->createClassNamespace($constrant), |
|
43 | 43 | 'DbTable', |
44 | - AbstractMaker::getClassName ( $constrant->getTable () ) |
|
44 | + AbstractMaker::getClassName($constrant->getTable()) |
|
45 | 45 | ); |
46 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
46 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
47 | 47 | |
48 | - $references[] = sprintf ( |
|
48 | + $references[] = sprintf( |
|
49 | 49 | " |
50 | 50 | '%s' => array ( |
51 | 51 | 'columns' => '%s' , |
52 | 52 | 'refTableClass' => '%s', |
53 | 53 | 'refColumns' =>'%s' |
54 | 54 | )", |
55 | - AbstractMaker::getClassName ( $constrant->getNameConstrant () ), |
|
56 | - $objColumn->getName (), |
|
55 | + AbstractMaker::getClassName($constrant->getNameConstrant()), |
|
56 | + $objColumn->getName(), |
|
57 | 57 | $class, |
58 | - $constrant->getColumn () |
|
58 | + $constrant->getColumn() |
|
59 | 59 | |
60 | 60 | ); |
61 | 61 | } |
62 | 62 | |
63 | - if ( sizeof ( $references ) > 0 ) |
|
63 | + if (sizeof($references) > 0) |
|
64 | 64 | { |
65 | 65 | $referenceMap = "protected \$_referenceMap = array(" . |
66 | - join ( ',', $references ) . "\n );"; |
|
66 | + join(',', $references) . "\n );"; |
|
67 | 67 | } |
68 | 68 | |
69 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
69 | + foreach ($dbTable->getDependences() as $objColumn) |
|
70 | 70 | { |
71 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
71 | + foreach ($objColumn->getDependences() as $dependence) |
|
72 | 72 | { |
73 | - $arrClass = array ( |
|
74 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ), |
|
73 | + $arrClass = array( |
|
74 | + $makerFile->getConfig()->createClassNamespace($dependence), |
|
75 | 75 | 'DbTable', |
76 | - AbstractMaker::getClassName ( $dependence->getTable () ) |
|
76 | + AbstractMaker::getClassName($dependence->getTable()) |
|
77 | 77 | ); |
78 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
78 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
79 | 79 | |
80 | 80 | $dependents[] = $class; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - if ( sizeof ( $dependents ) > 0 ) |
|
84 | + if (sizeof($dependents) > 0) |
|
85 | 85 | { |
86 | 86 | $dependentTables = "protected \$_dependentTables = array(\n '" . |
87 | - join ( "',\n '", $dependents ) . "'\n );"; |
|
87 | + join("',\n '", $dependents) . "'\n );"; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - return array ( |
|
91 | + return array( |
|
92 | 92 | 'referenceMap' => $referenceMap, |
93 | 93 | 'dependentTables' => $dependentTables |
94 | 94 | ); |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * @param \Classes\Db\DbTable|\Classes\Db\Constrant $table |
138 | 138 | * |
139 | - * @return mixed |
|
139 | + * @return string |
|
140 | 140 | */ |
141 | 141 | |
142 | 142 | public function createClassNamespace ( $table ) |
@@ -225,6 +225,9 @@ discard block |
||
225 | 225 | return true; |
226 | 226 | } |
227 | 227 | |
228 | + /** |
|
229 | + * @return string |
|
230 | + */ |
|
228 | 231 | protected function getFrameworkIni () |
229 | 232 | { |
230 | 233 | return $this->framworkFiles[ 'ini' ]; |
@@ -332,7 +335,6 @@ discard block |
||
332 | 335 | } |
333 | 336 | |
334 | 337 | /** |
335 | - * @param string $schema |
|
336 | 338 | * |
337 | 339 | * @return string |
338 | 340 | */ |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | abstract class AbstractAdapter |
15 | 15 | { |
16 | 16 | |
17 | - protected $arrConfig = array ( |
|
17 | + protected $arrConfig = array( |
|
18 | 18 | ############################# DATABASE |
19 | 19 | //Driver do banco de dados |
20 | 20 | 'driver' => null, |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | //senha do banco |
30 | 30 | 'password' => null, |
31 | 31 | // lista de schemas do banco de dados |
32 | - 'schema' => array (), |
|
32 | + 'schema' => array(), |
|
33 | 33 | |
34 | 34 | 'socket' => null, |
35 | 35 | |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | // flags para criar todas as tabelas ou nao |
62 | 62 | 'allTables' => true, |
63 | 63 | //Lista de tabelas a serem ignoradas |
64 | - 'ignoreTable' => array (), |
|
64 | + 'ignoreTable' => array(), |
|
65 | 65 | ); |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * @var string[] um array com todos os campos obrigatorios |
69 | 69 | */ |
70 | - protected $attRequered = array ( |
|
70 | + protected $attRequered = array( |
|
71 | 71 | 'driver' => true, |
72 | 72 | 'database' => true, |
73 | 73 | 'host' => true, |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | 'path' => true |
76 | 76 | ); |
77 | 77 | |
78 | - protected $arrFunc = array (); |
|
78 | + protected $arrFunc = array(); |
|
79 | 79 | |
80 | - private $framworkFiles = array (); |
|
80 | + private $framworkFiles = array(); |
|
81 | 81 | |
82 | - public $reservedWord = array (); |
|
82 | + public $reservedWord = array(); |
|
83 | 83 | |
84 | 84 | const SEPARETOR = ""; |
85 | 85 | |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return bool |
90 | 90 | */ |
91 | - protected function checkConfig () |
|
91 | + protected function checkConfig() |
|
92 | 92 | { |
93 | - if ( array_diff_key ( $this->attRequered, array_filter ( $this->arrConfig ) ) ) { |
|
93 | + if (array_diff_key($this->attRequered, array_filter($this->arrConfig))) { |
|
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | |
@@ -102,33 +102,33 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - abstract protected function getParams (); |
|
105 | + abstract protected function getParams(); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Popula as config do generater com as configuraçoes do framework |
109 | 109 | * |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - abstract protected function parseFrameworkConfig (); |
|
112 | + abstract protected function parseFrameworkConfig(); |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Cria Instancias dos arquivos que devem ser gerados |
116 | 116 | * |
117 | 117 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
118 | 118 | */ |
119 | - abstract public function getMakeFileInstances (); |
|
119 | + abstract public function getMakeFileInstances(); |
|
120 | 120 | |
121 | - abstract protected function init (); |
|
121 | + abstract protected function init(); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * retorna a base do Namespace |
125 | 125 | * |
126 | 126 | * @return array |
127 | 127 | */ |
128 | - protected function getBaseNamespace () |
|
128 | + protected function getBaseNamespace() |
|
129 | 129 | { |
130 | - return array ( |
|
131 | - $this->arrConfig[ 'namespace' ], |
|
130 | + return array( |
|
131 | + $this->arrConfig['namespace'], |
|
132 | 132 | 'Model' |
133 | 133 | ); |
134 | 134 | } |
@@ -139,47 +139,47 @@ discard block |
||
139 | 139 | * @return mixed |
140 | 140 | */ |
141 | 141 | |
142 | - public function createClassNamespace ( $table ) |
|
142 | + public function createClassNamespace($table) |
|
143 | 143 | { |
144 | - $arrNames = $this->getBaseNamespace (); |
|
144 | + $arrNames = $this->getBaseNamespace(); |
|
145 | 145 | |
146 | - if ( isset( $this->arrConfig[ 'folder-database' ] ) |
|
147 | - && $this->arrConfig[ 'folder-database' ] |
|
146 | + if (isset($this->arrConfig['folder-database']) |
|
147 | + && $this->arrConfig['folder-database'] |
|
148 | 148 | ) { |
149 | - $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'driver' ] ); |
|
149 | + $arrNames[] = AbstractMaker::getClassName($this->arrConfig['driver']); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( isset( $this->arrConfig[ 'folder-name' ] ) |
|
153 | - && $this->arrConfig[ 'folder-name' ] |
|
152 | + if (isset($this->arrConfig['folder-name']) |
|
153 | + && $this->arrConfig['folder-name'] |
|
154 | 154 | ) { |
155 | - $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'folder-name' ] ); |
|
155 | + $arrNames[] = AbstractMaker::getClassName($this->arrConfig['folder-name']); |
|
156 | 156 | } |
157 | 157 | |
158 | - if ( $table->hasSchema () ) { |
|
159 | - $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getSchema () ) ); |
|
158 | + if ($table->hasSchema()) { |
|
159 | + $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getSchema())); |
|
160 | 160 | } |
161 | 161 | else { |
162 | - $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getDatabase () ) ); |
|
162 | + $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getDatabase())); |
|
163 | 163 | } |
164 | 164 | |
165 | - return implode ( static::SEPARETOR, array_filter ( $arrNames ) ); |
|
165 | + return implode(static::SEPARETOR, array_filter($arrNames)); |
|
166 | 166 | } |
167 | 167 | |
168 | - public function __construct ( $array ) |
|
168 | + public function __construct($array) |
|
169 | 169 | { |
170 | - $array += array ( |
|
171 | - 'author' => ucfirst ( get_current_user () ), |
|
172 | - 'last_modify' => date ( "d-m-Y H:i:s." ) |
|
170 | + $array += array( |
|
171 | + 'author' => ucfirst(get_current_user()), |
|
172 | + 'last_modify' => date("d-m-Y H:i:s.") |
|
173 | 173 | ); |
174 | 174 | |
175 | - $this->setFrameworkFiles ( $array ); |
|
176 | - $this->parseFrameworkConfig (); |
|
177 | - $this->setParams ( $this->getParams () ); |
|
178 | - $this->setParams ( $array ); |
|
179 | - $this->init (); |
|
180 | - if ( !$this->isValid () ) { |
|
181 | - $var = array_diff_key ( $this->attRequered, array_filter ( $this->arrConfig ) ); |
|
182 | - throw new Exception( $var ); |
|
175 | + $this->setFrameworkFiles($array); |
|
176 | + $this->parseFrameworkConfig(); |
|
177 | + $this->setParams($this->getParams()); |
|
178 | + $this->setParams($array); |
|
179 | + $this->init(); |
|
180 | + if ( ! $this->isValid()) { |
|
181 | + $var = array_diff_key($this->attRequered, array_filter($this->arrConfig)); |
|
182 | + throw new Exception($var); |
|
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
@@ -188,36 +188,36 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param $array |
190 | 190 | */ |
191 | - public function setFrameworkFiles ( $array ) |
|
191 | + public function setFrameworkFiles($array) |
|
192 | 192 | { |
193 | - $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] ) ? $array[ 'framework-path-library' ] : null; |
|
193 | + $this->framworkFiles['library'] = isset($array['framework-path-library']) ? $array['framework-path-library'] : null; |
|
194 | 194 | |
195 | - $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] ) ? $array[ 'framework-ini' ] : null; |
|
195 | + $this->framworkFiles['ini'] = isset($array['framework-ini']) ? $array['framework-ini'] : null; |
|
196 | 196 | |
197 | - $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] ) ? $array[ 'environment' ] : 'production'; |
|
197 | + $this->framworkFiles['environment'] = isset($array['environment']) ? $array['environment'] : 'production'; |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | - protected function isValidFrameworkFiles () |
|
201 | + protected function isValidFrameworkFiles() |
|
202 | 202 | { |
203 | - if ( !is_file ( $this->framworkFiles[ 'ini' ] ) ) { |
|
203 | + if ( ! is_file($this->framworkFiles['ini'])) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | |
207 | - if ( !is_dir ( $this->framworkFiles[ 'library' ] ) ) { |
|
207 | + if ( ! is_dir($this->framworkFiles['library'])) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | |
211 | 211 | |
212 | - if ( !isset ( $this->framworkFiles[ 'environment' ] ) or empty( $this->framworkFiles[ 'environment' ] ) ) { |
|
212 | + if ( ! isset ($this->framworkFiles['environment']) or empty($this->framworkFiles['environment'])) { |
|
213 | 213 | return false; |
214 | 214 | } |
215 | - set_include_path ( |
|
216 | - implode ( |
|
215 | + set_include_path( |
|
216 | + implode( |
|
217 | 217 | PATH_SEPARATOR, |
218 | - array ( |
|
219 | - realpath ( $this->framworkFiles[ 'library' ] ), |
|
220 | - get_include_path (), |
|
218 | + array( |
|
219 | + realpath($this->framworkFiles['library']), |
|
220 | + get_include_path(), |
|
221 | 221 | ) |
222 | 222 | ) |
223 | 223 | ); |
@@ -225,110 +225,110 @@ discard block |
||
225 | 225 | return true; |
226 | 226 | } |
227 | 227 | |
228 | - protected function getFrameworkIni () |
|
228 | + protected function getFrameworkIni() |
|
229 | 229 | { |
230 | - return $this->framworkFiles[ 'ini' ]; |
|
230 | + return $this->framworkFiles['ini']; |
|
231 | 231 | } |
232 | 232 | |
233 | - protected function getEnvironment () |
|
233 | + protected function getEnvironment() |
|
234 | 234 | { |
235 | - return $this->framworkFiles[ 'environment' ]; |
|
235 | + return $this->framworkFiles['environment']; |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Popula as variaveis de acordo com o arquivo de configuração do seu framework |
240 | 240 | */ |
241 | - protected function isValid () |
|
241 | + protected function isValid() |
|
242 | 242 | { |
243 | - return $this->checkConfig (); |
|
243 | + return $this->checkConfig(); |
|
244 | 244 | } |
245 | 245 | |
246 | - private function setParams ( $array ) |
|
246 | + private function setParams($array) |
|
247 | 247 | { |
248 | - if ( count ( $array ) > 0 ) { |
|
249 | - $this->arrConfig = array_filter ( $array ) + $this->arrConfig; |
|
248 | + if (count($array) > 0) { |
|
249 | + $this->arrConfig = array_filter($array) + $this->arrConfig; |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
254 | 254 | * @return string |
255 | 255 | */ |
256 | - public function getDatabase () |
|
256 | + public function getDatabase() |
|
257 | 257 | { |
258 | - return $this->arrConfig[ 'database' ]; |
|
258 | + return $this->arrConfig['database']; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
262 | 262 | * @return bool |
263 | 263 | */ |
264 | - public function hasSchemas () |
|
264 | + public function hasSchemas() |
|
265 | 265 | { |
266 | - return !empty ( $this->arrConfig[ 'schema' ] ); |
|
266 | + return ! empty ($this->arrConfig['schema']); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
270 | 270 | * @return string[] |
271 | 271 | */ |
272 | - public function getSchemas () |
|
272 | + public function getSchemas() |
|
273 | 273 | { |
274 | - if ( is_string ( $this->arrConfig[ 'schema' ] ) ) { |
|
275 | - return array ( $this->arrConfig[ 'schema' ] ); |
|
274 | + if (is_string($this->arrConfig['schema'])) { |
|
275 | + return array($this->arrConfig['schema']); |
|
276 | 276 | } |
277 | 277 | |
278 | - return $this->arrConfig[ 'schema' ]; |
|
278 | + return $this->arrConfig['schema']; |
|
279 | 279 | } |
280 | 280 | |
281 | - public function setSchema ( $schema ) |
|
281 | + public function setSchema($schema) |
|
282 | 282 | { |
283 | - $this->arrConfig[ 'schema' ] = $schema; |
|
283 | + $this->arrConfig['schema'] = $schema; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
287 | 287 | * @return string |
288 | 288 | */ |
289 | - public function getHost () |
|
289 | + public function getHost() |
|
290 | 290 | { |
291 | - return $this->arrConfig[ 'host' ]; |
|
291 | + return $this->arrConfig['host']; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
295 | 295 | * @return int |
296 | 296 | */ |
297 | - public function getPort () |
|
297 | + public function getPort() |
|
298 | 298 | { |
299 | - return $this->arrConfig[ 'port' ]; |
|
299 | + return $this->arrConfig['port']; |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
303 | 303 | * @return boolean |
304 | 304 | */ |
305 | - public function hasPort () |
|
305 | + public function hasPort() |
|
306 | 306 | { |
307 | - return !empty( $this->arrConfig[ 'port' ] ); |
|
307 | + return ! empty($this->arrConfig['port']); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | 311 | * @return string |
312 | 312 | */ |
313 | - public function getSocket () |
|
313 | + public function getSocket() |
|
314 | 314 | { |
315 | - return $this->arrConfig[ 'socket' ]; |
|
315 | + return $this->arrConfig['socket']; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
319 | 319 | * @return string |
320 | 320 | */ |
321 | - public function getUser () |
|
321 | + public function getUser() |
|
322 | 322 | { |
323 | - return $this->arrConfig[ 'username' ]; |
|
323 | + return $this->arrConfig['username']; |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @return string |
328 | 328 | */ |
329 | - public function getPassword () |
|
329 | + public function getPassword() |
|
330 | 330 | { |
331 | - return $this->arrConfig[ 'password' ]; |
|
331 | + return $this->arrConfig['password']; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @return string |
338 | 338 | */ |
339 | - public function replaceReservedWord ( $palavra ) |
|
339 | + public function replaceReservedWord($palavra) |
|
340 | 340 | { |
341 | - if ( isset( $this->reservedWord[ strtolower ( $palavra ) ] ) ) { |
|
342 | - return $this->reservedWord[ strtolower ( $palavra ) ]; |
|
341 | + if (isset($this->reservedWord[strtolower($palavra)])) { |
|
342 | + return $this->reservedWord[strtolower($palavra)]; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | return $palavra; |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | /** |
349 | 349 | * @return bool |
350 | 350 | */ |
351 | - public function isStatusEnabled () |
|
351 | + public function isStatusEnabled() |
|
352 | 352 | { |
353 | - return (bool) $this->arrConfig[ 'status' ]; |
|
353 | + return (bool) $this->arrConfig['status']; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return string |
360 | 360 | */ |
361 | - public function __get ( $str ) |
|
361 | + public function __get($str) |
|
362 | 362 | { |
363 | - $arr = array ( |
|
363 | + $arr = array( |
|
364 | 364 | 'namespace', |
365 | 365 | 'framework', |
366 | 366 | 'author', |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | 'folder-name' |
374 | 374 | ); |
375 | 375 | |
376 | - if ( in_array ( $str, $arr ) ) { |
|
377 | - return $this->arrConfig[ strtolower ( $str ) ]; |
|
376 | + if (in_array($str, $arr)) { |
|
377 | + return $this->arrConfig[strtolower($str)]; |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | return; |
@@ -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, |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | '$this->belongsTo(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
55 | 55 | $objColumn->getName (), |
56 | 56 | $makerFile->getConfig () |
57 | - ->createClassNamespace ( $constrant ) . Phalcon::SEPARETOR . AbstractMaker::getClassName ( |
|
57 | + ->createClassNamespace ( $constrant ) . Phalcon::SEPARETOR . AbstractMaker::getClassName ( |
|
58 | 58 | $constrant->getTable () |
59 | 59 | ), |
60 | 60 | $constrant->getColumn (), |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | '$this->hasMany(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
87 | 87 | $objColumn->getName (), |
88 | 88 | $makerFile->getConfig () |
89 | - ->createClassNamespace ( $dependence ) |
|
89 | + ->createClassNamespace ( $dependence ) |
|
90 | 90 | . Phalcon::SEPARETOR |
91 | 91 | . AbstractMaker::getClassName ( $dependence->getTable () ), |
92 | 92 | $dependence->getColumn (), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected $fileTpl = "entity.php"; |
21 | 21 | protected $overwrite = true; |
22 | 22 | |
23 | - protected $validFunc = array (); |
|
23 | + protected $validFunc = array(); |
|
24 | 24 | |
25 | 25 | private $intersectDependence = false; |
26 | 26 | |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
33 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
34 | 34 | { |
35 | - return array ( |
|
36 | - 'mapParents' => $this->listParents ( $makerFile, $dbTable ), |
|
37 | - 'mapDependents' => $this->listDependence ( $makerFile, $dbTable ) |
|
35 | + return array( |
|
36 | + 'mapParents' => $this->listParents($makerFile, $dbTable), |
|
37 | + 'mapDependents' => $this->listDependence($makerFile, $dbTable) |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
@@ -44,26 +44,26 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array |
46 | 46 | */ |
47 | - private function listParents ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
47 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
48 | 48 | { |
49 | 49 | $mapParents = ''; |
50 | - $references = array (); |
|
51 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) { |
|
52 | - $constrant = $objColumn->getFks (); |
|
53 | - $references[] = sprintf ( |
|
50 | + $references = array(); |
|
51 | + foreach ($dbTable->getForeingkeys() as $objColumn) { |
|
52 | + $constrant = $objColumn->getFks(); |
|
53 | + $references[] = sprintf( |
|
54 | 54 | '$this->belongsTo(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
55 | - $objColumn->getName (), |
|
56 | - $makerFile->getConfig () |
|
57 | - ->createClassNamespace ( $constrant ) . Phalcon::SEPARETOR . AbstractMaker::getClassName ( |
|
58 | - $constrant->getTable () |
|
55 | + $objColumn->getName(), |
|
56 | + $makerFile->getConfig() |
|
57 | + ->createClassNamespace($constrant) . Phalcon::SEPARETOR . AbstractMaker::getClassName( |
|
58 | + $constrant->getTable() |
|
59 | 59 | ), |
60 | - $constrant->getColumn (), |
|
61 | - AbstractMaker::getClassName ( $constrant->getTable () ) |
|
60 | + $constrant->getColumn(), |
|
61 | + AbstractMaker::getClassName($constrant->getTable()) |
|
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | - if ( sizeof ( $references ) > 0 ) { |
|
66 | - $mapParents = join ( ";\n\t\t", $references ) . ";\n"; |
|
65 | + if (sizeof($references) > 0) { |
|
66 | + $mapParents = join(";\n\t\t", $references) . ";\n"; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -76,28 +76,28 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return array |
78 | 78 | */ |
79 | - private function listDependence ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
79 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
80 | 80 | { |
81 | 81 | $mapDependence = ''; |
82 | - $references = array (); |
|
83 | - foreach ( $dbTable->getDependences () as $objColumn ) { |
|
84 | - foreach ( $objColumn->getDependences () as $dependence ) { |
|
85 | - $references[] = sprintf ( |
|
82 | + $references = array(); |
|
83 | + foreach ($dbTable->getDependences() as $objColumn) { |
|
84 | + foreach ($objColumn->getDependences() as $dependence) { |
|
85 | + $references[] = sprintf( |
|
86 | 86 | '$this->hasMany(\'%s\', \'%s\', \'%s\', array(\'alias\' => \'%s\'))', |
87 | - $objColumn->getName (), |
|
88 | - $makerFile->getConfig () |
|
89 | - ->createClassNamespace ( $dependence ) |
|
87 | + $objColumn->getName(), |
|
88 | + $makerFile->getConfig() |
|
89 | + ->createClassNamespace($dependence) |
|
90 | 90 | . Phalcon::SEPARETOR |
91 | - . AbstractMaker::getClassName ( $dependence->getTable () ), |
|
92 | - $dependence->getColumn (), |
|
93 | - AbstractMaker::getClassName ( $dependence->getTable () ) |
|
91 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
92 | + $dependence->getColumn(), |
|
93 | + AbstractMaker::getClassName($dependence->getTable()) |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if ( sizeof ( $references ) > 0 ) { |
|
100 | - $mapDependence = join ( ";\n\t\t", $references ) . ";"; |
|
99 | + if (sizeof($references) > 0) { |
|
100 | + $mapDependence = join(";\n\t\t", $references) . ";"; |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | return $mapDependence; |
@@ -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?$this->config->namespace."_":""?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
19 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace ? $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,12 +52,12 @@ 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 | ); |
59 | 59 | <?php endif ?> |
60 | -<?php if($this->config->{'folder-name'}):?> |
|
60 | +<?php if ($this->config->{'folder-name'}):?> |
|
61 | 61 | /** |
62 | 62 | * Initialize database adapter. |
63 | 63 | * |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | parent::_setupDatabaseAdapter(); |
73 | 73 | } |
74 | 74 | <?php endif ?> |
75 | -<?php if( $objTables->hasSequences() ) : ?> |
|
75 | +<?php if ($objTables->hasSequences()) : ?> |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Definir a lógica para os novos valores na chave primária. |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @var mixed |
82 | 82 | */ |
83 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
84 | -<?php if(strpos($this->config->driver, 'pgsql')): ?> |
|
85 | -<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
83 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
84 | +<?php if (strpos($this->config->driver, 'pgsql')): ?> |
|
85 | +<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
86 | 86 | protected $_sequence = '<?=$seq->getSequence() ?>'; |
87 | 87 | <?php else: ?> |
88 | 88 | protected $_sequence = true; |
@@ -3,17 +3,17 @@ 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"?> |
|
14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
15 | + * @license <?=$this->config->license . "\n"?> |
|
16 | + * @link <?=$this->config->link . "\n"?> |
|
17 | 17 | * |
18 | 18 | * @abstract |
19 | 19 | */ |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * Zend DB Table Abstract class |
23 | 23 | */ |
24 | 24 | |
25 | -abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
25 | +abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_TableAbstract extends Zend_Db_Table_Abstract |
|
26 | 26 | { |
27 | 27 | /** |
28 | 28 | * Nome da tabela do banco de dados |
@@ -3,18 +3,18 @@ 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"?> |
|
12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
13 | + * @license <?=$this->config->license . "\n"?> |
|
14 | + * @link <?=$this->config->link . "\n"?> |
|
15 | 15 | */ |
16 | 16 | |
17 | -abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
|
17 | +abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
|
18 | 18 | { |
19 | 19 | |
20 | 20 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | /** |
76 | 76 | * @param array $data |
77 | - * @return <?=$this->config->namespace?$this->config->namespace."_":""?>>Model_EntityAbstract |
|
77 | + * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>>Model_EntityAbstract |
|
78 | 78 | */ |
79 | 79 | public static function getIntance($data = array()) |
80 | 80 | { |