@@ -13,15 +13,15 @@ |
||
13 | 13 | |
14 | 14 | public $pastName = 'Peer'; |
15 | 15 | protected $fileTpl = "peer.php"; |
16 | - protected $fileFixedData = array ( |
|
17 | - 'parentclass' => array ( |
|
18 | - 'name' => "AbstractPeer" , |
|
16 | + protected $fileFixedData = array( |
|
17 | + 'parentclass' => array( |
|
18 | + 'name' => "AbstractPeer", |
|
19 | 19 | 'tpl' => "peer_abstract.php" |
20 | 20 | ) |
21 | 21 | ); |
22 | 22 | |
23 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
23 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
24 | 24 | { |
25 | - return array (); |
|
25 | + return array(); |
|
26 | 26 | } |
27 | 27 | } |
@@ -18,19 +18,19 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public $pastName = 'Entity'; |
20 | 20 | protected $fileTpl = "entity.php"; |
21 | - protected $fileFixedData = array ( |
|
22 | - 'parentclass' => array ( |
|
23 | - 'name' => "EntityAbstract" , |
|
21 | + protected $fileFixedData = array( |
|
22 | + 'parentclass' => array( |
|
23 | + 'name' => "EntityAbstract", |
|
24 | 24 | 'tpl' => "entity_abstract.php" |
25 | - ) , |
|
26 | - 'exception' => array ( |
|
27 | - 'name' => "EntityException" , |
|
25 | + ), |
|
26 | + 'exception' => array( |
|
27 | + 'name' => "EntityException", |
|
28 | 28 | 'tpl' => "entity_exception.php" |
29 | 29 | ) |
30 | 30 | ); |
31 | - protected $overwrite = true; |
|
31 | + protected $overwrite = true; |
|
32 | 32 | |
33 | - protected $validFunc = array (); |
|
33 | + protected $validFunc = array(); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @param \Classes\MakerFile $makerFile |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return array |
40 | 40 | */ |
41 | - public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
41 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
42 | 42 | { |
43 | - return array ( |
|
44 | - 'parents' => $this->listParents ( $makerFile , $dbTable ) , |
|
45 | - 'depends' => $this->listDependence ( $makerFile , $dbTable ) |
|
43 | + return array( |
|
44 | + 'parents' => $this->listParents($makerFile, $dbTable), |
|
45 | + 'depends' => $this->listDependence($makerFile, $dbTable) |
|
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
@@ -52,39 +52,39 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return array |
54 | 54 | */ |
55 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
55 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
56 | 56 | { |
57 | - $parents = array (); |
|
58 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
57 | + $parents = array(); |
|
58 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
59 | 59 | { |
60 | - $constrant = $objColumn->getFks (); |
|
60 | + $constrant = $objColumn->getFks(); |
|
61 | 61 | $name = |
62 | 62 | 'Parent' |
63 | 63 | . ZendFrameworkOne::SEPARETOR |
64 | - . AbstractMaker::getClassName ( $constrant->getTable () ) |
|
64 | + . AbstractMaker::getClassName($constrant->getTable()) |
|
65 | 65 | . ZendFrameworkOne::SEPARETOR |
66 | 66 | . 'By' |
67 | 67 | . ZendFrameworkOne::SEPARETOR |
68 | - . $objColumn->getName (); |
|
68 | + . $objColumn->getName(); |
|
69 | 69 | |
70 | - $variable = $constrant->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName (); |
|
70 | + $variable = $constrant->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName(); |
|
71 | 71 | |
72 | - $arrClass = array ( |
|
73 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ), |
|
74 | - AbstractMaker::getClassName ( $constrant->getTable () ) |
|
72 | + $arrClass = array( |
|
73 | + $makerFile->getConfig()->createClassNamespace($constrant), |
|
74 | + AbstractMaker::getClassName($constrant->getTable()) |
|
75 | 75 | ); |
76 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
77 | - |
|
78 | - $parents[] = array ( |
|
79 | - 'class' => $class , |
|
80 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
81 | - 'table' => $constrant->getTable () , |
|
82 | - 'column' => $constrant->getColumn() , |
|
83 | - 'name' => $constrant->getNameConstrant() , |
|
76 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
77 | + |
|
78 | + $parents[] = array( |
|
79 | + 'class' => $class, |
|
80 | + 'function' => AbstractMaker::getClassName($name), |
|
81 | + 'table' => $constrant->getTable(), |
|
82 | + 'column' => $constrant->getColumn(), |
|
83 | + 'name' => $constrant->getNameConstrant(), |
|
84 | 84 | 'variable' => $variable |
85 | 85 | |
86 | 86 | ); |
87 | - unset( $name ); |
|
87 | + unset($name); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | return $parents; |
@@ -96,43 +96,43 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
99 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
100 | 100 | { |
101 | - $depends = array (); |
|
102 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
101 | + $depends = array(); |
|
102 | + foreach ($dbTable->getDependences() as $objColumn) |
|
103 | 103 | { |
104 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
104 | + foreach ($objColumn->getDependences() as $dependence) |
|
105 | 105 | { |
106 | 106 | $name = |
107 | 107 | 'Depend' |
108 | 108 | . ZendFrameworkOne::SEPARETOR |
109 | - . AbstractMaker::getClassName ( $dependence->getTable () ) |
|
109 | + . AbstractMaker::getClassName($dependence->getTable()) |
|
110 | 110 | . ZendFrameworkOne::SEPARETOR |
111 | 111 | . 'By' |
112 | 112 | . ZendFrameworkOne::SEPARETOR |
113 | - . $objColumn->getName (); |
|
113 | + . $objColumn->getName(); |
|
114 | 114 | |
115 | - if ( ! key_exists ( $name , $this->validFunc ) ) |
|
115 | + if ( ! key_exists($name, $this->validFunc)) |
|
116 | 116 | { |
117 | - $variable = $dependence->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName (); |
|
117 | + $variable = $dependence->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName(); |
|
118 | 118 | |
119 | - $arrClass = array ( |
|
120 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ), |
|
121 | - AbstractMaker::getClassName ( $dependence->getTable () ) |
|
119 | + $arrClass = array( |
|
120 | + $makerFile->getConfig()->createClassNamespace($dependence), |
|
121 | + AbstractMaker::getClassName($dependence->getTable()) |
|
122 | 122 | ); |
123 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
123 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
124 | 124 | |
125 | - $this->validFunc[ $name ] = true; |
|
126 | - $depends[] = array ( |
|
125 | + $this->validFunc[$name] = true; |
|
126 | + $depends[] = array( |
|
127 | 127 | 'class' => $class, |
128 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
129 | - 'table' => $dependence->getTable () , |
|
130 | - 'column' => $dependence->getColumn () , |
|
131 | - 'name' => $dependence->getNameConstrant (), |
|
128 | + 'function' => AbstractMaker::getClassName($name), |
|
129 | + 'table' => $dependence->getTable(), |
|
130 | + 'column' => $dependence->getColumn(), |
|
131 | + 'name' => $dependence->getNameConstrant(), |
|
132 | 132 | 'variable' => $variable |
133 | 133 | ); |
134 | 134 | } |
135 | - unset( $name ); |
|
135 | + unset($name); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -15,14 +15,14 @@ discard block |
||
15 | 15 | |
16 | 16 | public $pastName = 'DbTable'; |
17 | 17 | protected $fileTpl = "dbtable.php"; |
18 | - protected $fileFixedData = array ( |
|
19 | - 'parentclass' => array ( |
|
20 | - 'name' => "TableAbstract" , |
|
18 | + protected $fileFixedData = array( |
|
19 | + 'parentclass' => array( |
|
20 | + 'name' => "TableAbstract", |
|
21 | 21 | 'tpl' => "dbtable_abstract.php" |
22 | 22 | ) |
23 | 23 | ); |
24 | 24 | |
25 | - protected $overwrite = true; |
|
25 | + protected $overwrite = true; |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param \Classes\MakerFile $makerFile |
@@ -30,68 +30,68 @@ 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 | 35 | $referenceMap = ''; |
36 | - $references = array (); |
|
36 | + $references = array(); |
|
37 | 37 | $dependentTables = ''; |
38 | - $dependents = array (); |
|
39 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
38 | + $dependents = array(); |
|
39 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
40 | 40 | { |
41 | - $constrant = $objColumn->getFks (); |
|
42 | - $variable = $constrant->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName (); |
|
41 | + $constrant = $objColumn->getFks(); |
|
42 | + $variable = $constrant->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName(); |
|
43 | 43 | |
44 | - $arrClass = array ( |
|
45 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ), |
|
44 | + $arrClass = array( |
|
45 | + $makerFile->getConfig()->createClassNamespace($constrant), |
|
46 | 46 | 'DbTable', |
47 | - AbstractMaker::getClassName ( $constrant->getTable () ) |
|
47 | + AbstractMaker::getClassName($constrant->getTable()) |
|
48 | 48 | ); |
49 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
49 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
50 | 50 | |
51 | - $references[] = sprintf ( |
|
51 | + $references[] = sprintf( |
|
52 | 52 | " |
53 | 53 | '%s' => array ( |
54 | 54 | 'columns' => '%s' , |
55 | 55 | 'refTableClass' => '%s', |
56 | 56 | 'refColumns' =>'%s' |
57 | 57 | )", |
58 | - AbstractMaker::getClassName ( $variable ), |
|
59 | - $objColumn->getName (), |
|
58 | + AbstractMaker::getClassName($variable), |
|
59 | + $objColumn->getName(), |
|
60 | 60 | $class, |
61 | - $constrant->getColumn () |
|
61 | + $constrant->getColumn() |
|
62 | 62 | |
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
66 | - if ( sizeof ( $references ) > 0 ) |
|
66 | + if (sizeof($references) > 0) |
|
67 | 67 | { |
68 | 68 | $referenceMap = "protected \$_referenceMap = array(" . |
69 | - join ( ',', $references ) . "\n );"; |
|
69 | + join(',', $references) . "\n );"; |
|
70 | 70 | } |
71 | 71 | |
72 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
72 | + foreach ($dbTable->getDependences() as $objColumn) |
|
73 | 73 | { |
74 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
74 | + foreach ($objColumn->getDependences() as $dependence) |
|
75 | 75 | { |
76 | - $arrClass = array ( |
|
77 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ), |
|
76 | + $arrClass = array( |
|
77 | + $makerFile->getConfig()->createClassNamespace($dependence), |
|
78 | 78 | 'DbTable', |
79 | - AbstractMaker::getClassName ( $dependence->getTable () ) |
|
79 | + AbstractMaker::getClassName($dependence->getTable()) |
|
80 | 80 | ); |
81 | - $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) ); |
|
81 | + $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass)); |
|
82 | 82 | |
83 | 83 | $dependents[] = $class; |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - if ( sizeof ( $dependents ) > 0 ) |
|
87 | + if (sizeof($dependents) > 0) |
|
88 | 88 | { |
89 | 89 | $dependentTables = "protected \$_dependentTables = array(\n '" . |
90 | - join ( "',\n '", $dependents ) . "'\n );"; |
|
90 | + join("',\n '", $dependents) . "'\n );"; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | - return array ( |
|
94 | + return array( |
|
95 | 95 | 'referenceMap' => $referenceMap, |
96 | 96 | 'dependentTables' => $dependentTables |
97 | 97 | ); |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * @type AbstractAdapter[] |
13 | 13 | */ |
14 | - private static $_instance = array (); |
|
14 | + private static $_instance = array(); |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @type FilesFixeds[] |
18 | 18 | */ |
19 | - private $instanceFixedFile = array (); |
|
19 | + private $instanceFixedFile = array(); |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @param \Classes\MakerFile $makerFile |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return array |
26 | 26 | */ |
27 | - abstract public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ); |
|
27 | + abstract public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @type string nome do arquivo template |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @type string[][] |
43 | 43 | */ |
44 | - protected $fileFixedData = array (); |
|
44 | + protected $fileFixedData = array(); |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * @var bool |
@@ -51,22 +51,22 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * |
53 | 53 | */ |
54 | - final private function __construct () |
|
54 | + final private function __construct() |
|
55 | 55 | { |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @return \Classes\AdapterMakerFile\AbstractAdapter |
60 | 60 | */ |
61 | - public static function getInstance () |
|
61 | + public static function getInstance() |
|
62 | 62 | { |
63 | - $class = get_called_class (); |
|
64 | - if ( ! isset( self::$_instance[ $class ] ) ) |
|
63 | + $class = get_called_class(); |
|
64 | + if ( ! isset(self::$_instance[$class])) |
|
65 | 65 | { |
66 | - self::$_instance[ $class ] = new $class(); |
|
66 | + self::$_instance[$class] = new $class(); |
|
67 | 67 | } |
68 | 68 | |
69 | - return self::$_instance[ $class ]; |
|
69 | + return self::$_instance[$class]; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -74,28 +74,28 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return bool |
76 | 76 | */ |
77 | - public function hasDiretory () |
|
77 | + public function hasDiretory() |
|
78 | 78 | { |
79 | - return ! empty( $this->pastName ); |
|
79 | + return ! empty($this->pastName); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * @return \Classes\AdapterMakerFile\FilesFixeds |
84 | 84 | */ |
85 | - public function getFilesFixeds ( $key ) |
|
85 | + public function getFilesFixeds($key) |
|
86 | 86 | { |
87 | 87 | $key = strtolower($key); |
88 | - if ( ! isset( $this->fileFixedData[ $key ] ) ) |
|
88 | + if ( ! isset($this->fileFixedData[$key])) |
|
89 | 89 | { |
90 | - throw new \Exception( 'Não existe dados para popular o FilesFixeds ' . $key ); |
|
90 | + throw new \Exception('Não existe dados para popular o FilesFixeds ' . $key); |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( !isset($this->instanceFixedFile[ $key ]) or ! $this->instanceFixedFile[ $key ] instanceof FilesFixeds ) |
|
93 | + if ( ! isset($this->instanceFixedFile[$key]) or ! $this->instanceFixedFile[$key] instanceof FilesFixeds) |
|
94 | 94 | { |
95 | - $this->instanceFixedFile[ $key ] = FilesFixeds::getInstance ( $this->fileFixedData[ $key ] ); |
|
95 | + $this->instanceFixedFile[$key] = FilesFixeds::getInstance($this->fileFixedData[$key]); |
|
96 | 96 | } |
97 | 97 | |
98 | - return $this->instanceFixedFile[ $key ]; |
|
98 | + return $this->instanceFixedFile[$key]; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return bool |
105 | 105 | */ |
106 | - public function hasFilesFixeds ( $key ) |
|
106 | + public function hasFilesFixeds($key) |
|
107 | 107 | { |
108 | - return $this->getFilesFixeds ( strtolower($key) )->hasData (); |
|
108 | + return $this->getFilesFixeds(strtolower($key))->hasData(); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @return array |
115 | 115 | */ |
116 | - public function getListFilesFixed () |
|
116 | + public function getListFilesFixed() |
|
117 | 117 | { |
118 | - return \array_keys ( $this->fileFixedData ); |
|
118 | + return \array_keys($this->fileFixedData); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | 122 | * @return string |
123 | 123 | */ |
124 | - public function getFileTpl () |
|
124 | + public function getFileTpl() |
|
125 | 125 | { |
126 | 126 | return $this->fileTpl; |
127 | 127 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | /** |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public function getPastName () |
|
132 | + public function getPastName() |
|
133 | 133 | { |
134 | 134 | return $this->pastName; |
135 | 135 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | /** |
138 | 138 | * @return bool |
139 | 139 | */ |
140 | - public function isOverwrite () |
|
140 | + public function isOverwrite() |
|
141 | 141 | { |
142 | 142 | return $this->overwrite; |
143 | 143 | } |
@@ -3,43 +3,43 @@ discard block |
||
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()?>\Entity |
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()?>\Entity; |
19 | 19 | |
20 | 20 | use Phalcon\Validation; |
21 | 21 | |
22 | -abstract class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends \<?=$this->config->namespace?$this->config->namespace."\\":""?>Models\<?=$objMakeFile->getFilesFixeds('parentClass')->getFileName() . "\n"?> |
|
22 | +abstract class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends \<?=$this->config->namespace ? $this->config->namespace . "\\" : ""?>Models\<?=$objMakeFile->getFilesFixeds('parentClass')->getFileName() . "\n"?> |
|
23 | 23 | { |
24 | 24 | |
25 | 25 | <?php foreach ($objTables->getColumns() as $column): ?> |
26 | 26 | /** |
27 | - * column <?=$column->getName()."\n"?> |
|
27 | + * column <?=$column->getName() . "\n"?> |
|
28 | 28 | * |
29 | -<?php if($column->isPrimaryKey()):?> |
|
29 | +<?php if ($column->isPrimaryKey()):?> |
|
30 | 30 | * @Primary |
31 | 31 | <?php endif ?> |
32 | -<?php if($column->hasSequence()):?> |
|
32 | +<?php if ($column->hasSequence()):?> |
|
33 | 33 | * @Identity |
34 | 34 | <?php endif ?> |
35 | - * @Column(type="<?=$column->getTypeByConfig( $this->config )?>", nullable=<?=$column->isNullable () ? "true" : "false"?><?php |
|
36 | -if ( $column->getMaxLength () ): ?> |
|
37 | -, length=<?=$column->getMaxLength ()?> |
|
35 | + * @Column(type="<?=$column->getTypeByConfig($this->config)?>", nullable=<?=$column->isNullable() ? "true" : "false"?><?php |
|
36 | +if ($column->getMaxLength()): ?> |
|
37 | +, length=<?=$column->getMaxLength()?> |
|
38 | 38 | <?php endif ?>, column="<?=$column->getName()?>" ) |
39 | 39 | */ |
40 | 40 | protected $<?=$column->getName()?>; |
41 | 41 | |
42 | -<?php endforeach;?> |
|
42 | +<?php endforeach; ?> |
|
43 | 43 | /** |
44 | 44 | * Validations and business logic |
45 | 45 | * |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | $validator = new Validation(); |
51 | 51 | |
52 | 52 | <?php foreach ($objTables->getColumns() as $column): ?> |
53 | -<?php if(strtolower($column->getName()) == 'email'):?> |
|
53 | +<?php if (strtolower($column->getName()) == 'email'):?> |
|
54 | 54 | $validator->add( |
55 | 55 | 'email', |
56 | 56 | new \Phalcon\Validation\Validator\Email() |
57 | 57 | ); |
58 | 58 | |
59 | 59 | <?php endif ?> |
60 | -<?php endforeach;?> |
|
60 | +<?php endforeach; ?> |
|
61 | 61 | return $this->validate($validator); |
62 | 62 | } |
63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function initialize() |
68 | 68 | { |
69 | - <?=$mapDependents."\n"?> |
|
70 | - <?=$mapParents."\n"?> |
|
69 | + <?=$mapDependents . "\n"?> |
|
70 | + <?=$mapParents . "\n"?> |
|
71 | 71 | } |
72 | 72 | |
73 | -<?php if($objTables->hasSchema()): ?> |
|
73 | +<?php if ($objTables->hasSchema()): ?> |
|
74 | 74 | /** |
75 | 75 | * Returns schema name where table mapped is located |
76 | 76 | * |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | return '<?=$objTables->getName()?>'; |
93 | 93 | } |
94 | 94 | |
95 | -<?php if( $objTables->hasSequences() ) : ?> |
|
95 | +<?php if ($objTables->hasSequences()) : ?> |
|
96 | 96 | public function getSequenceName() |
97 | 97 | { |
98 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
99 | - <?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
98 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
99 | + <?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
100 | 100 | return "<?=$seq->getSequence() ?>"; |
101 | 101 | <?php endif ?> |
102 | 102 | } |
103 | 103 | |
104 | 104 | <?php endif ?> |
105 | 105 | <?php foreach ($objTables->getColumns() as $column): ?> |
106 | - public function set<?=$this->getClassName ( $column->getName () )?>( $<?=$column->getName()?> ) |
|
106 | + public function set<?=$this->getClassName($column->getName())?>( $<?=$column->getName()?> ) |
|
107 | 107 | { |
108 | 108 | $this-><?=$column->getName()?> = $<?=$column->getName()?>; |
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
112 | - * @return <?=$column->getType ()."\n" ?> |
|
112 | + * @return <?=$column->getType() . "\n" ?> |
|
113 | 113 | **/ |
114 | - public function get<?=$this->getClassName ( $column->getName () )?>() |
|
114 | + public function get<?=$this->getClassName($column->getName())?>() |
|
115 | 115 | { |
116 | - return (<?=$column->getType () ?>) $this-><?=$column->getName()?>; |
|
116 | + return (<?=$column->getType() ?>) $this-><?=$column->getName()?>; |
|
117 | 117 | } |
118 | -<?php endforeach;?> |
|
118 | +<?php endforeach; ?> |
|
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?="<?php\n"?> |
2 | 2 | |
3 | 3 | /** |
4 | - * <?=$this->config->last_modify."\n"?> |
|
4 | + * <?=$this->config->last_modify . "\n"?> |
|
5 | 5 | * |
6 | 6 | * @package <?=$this->config->namespace?>Model |
7 | 7 | * @subpackage Model |
8 | 8 | * @see Zend_Exception. <?="\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 | -class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_Exception extends Exception |
|
18 | +class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_Exception extends Exception |
|
19 | 19 | { |
20 | 20 | } |
@@ -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 | { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | /** |
243 | 243 | * Retorna o nome da coluna da primary key |
244 | 244 | * |
245 | - * @see <?=$this->config->namespace?$this->config->namespace."_":""?>Model_DbTable_TableAbstract::getPrimaryKeyName() |
|
245 | + * @see <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_DbTable_TableAbstract::getPrimaryKeyName() |
|
246 | 246 | * @return string|array The name or array of names which form the primary key |
247 | 247 | */ |
248 | 248 | public function getPrimaryKeyName() |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | /** |
254 | 254 | * @param int $primarykey |
255 | 255 | * |
256 | - * @return <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract |
|
256 | + * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract |
|
257 | 257 | */ |
258 | 258 | public function find ( $primarykey ) |
259 | 259 | { |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * @see Zend_Db_Table_Rowset_Abstract::fetchAll |
269 | 269 | * |
270 | - * @return <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract[] |
|
270 | + * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract[] |
|
271 | 271 | */ |
272 | 272 | public function fetchAll ( $where = null , $order = null , $count = null , $offset = null ) |
273 | 273 | { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * Retorna o objeto pela primary key |
279 | 279 | * |
280 | 280 | * @param int|array $primary_key |
281 | - * @return <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract |
|
281 | + * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract |
|
282 | 282 | */ |
283 | 283 | public static function retrieve ( $primarykey ) |
284 | 284 | { |
@@ -1,20 +1,20 @@ |
||
1 | 1 | <?="<?php\n"?> |
2 | 2 | |
3 | 3 | /** |
4 | - * <?=$this->config->last_modify."\n"?> |
|
4 | + * <?=$this->config->last_modify . "\n"?> |
|
5 | 5 | * |
6 | 6 | * @package <?=$this->config->namespace?>Model |
7 | 7 | * @subpackage Model |
8 | 8 | * @see Zend_Exception. <?="\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 | -class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityException extends Exception |
|
18 | +class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityException extends Exception |
|
19 | 19 | { |
20 | 20 | } |
@@ -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->getFilesFixeds('parentClass')->getFileName() . "\n"?> |
|
20 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_<?=$objMakeFile->getFilesFixeds('parentClass')->getFileName() . "\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; |