@@ -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 () or $column->hasColumnDefault()) ? "true" : "false"?><?php |
|
36 | -if ( $column->getMaxLength () ): ?> |
|
37 | -, length=<?=$column->getMaxLength ()?> |
|
35 | + * @Column(type="<?=$column->getTypeByConfig($this->config)?>", nullable=<?=($column->isNullable() or $column->hasColumnDefault()) ? "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,11 +92,11 @@ 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 | } |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | <?php endif ?> |
105 | 105 | <?php foreach ($objTables->getColumns() as $column): ?> |
106 | 106 | /** |
107 | - * @return <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ) . "\n" ?> |
|
107 | + * @return <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n" ?> |
|
108 | 108 | */ |
109 | - public function set<?=$this->getClassName ( $column->getName () )?>( $<?=$column->getName()?> ) |
|
109 | + public function set<?=$this->getClassName($column->getName())?>( $<?=$column->getName()?> ) |
|
110 | 110 | { |
111 | 111 | $this-><?=$column->getName()?> = $<?=$column->getName()?>; |
112 | 112 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * @return <?=$column->getType ( \Classes\Db\Column::TypePHP )."\n" ?> |
|
117 | + * @return <?=$column->getType(\Classes\Db\Column::TypePHP) . "\n" ?> |
|
118 | 118 | **/ |
119 | - public function get<?=$this->getClassName ( $column->getName () )?>() |
|
119 | + public function get<?=$this->getClassName($column->getName())?>() |
|
120 | 120 | { |
121 | - return (<?=$column->getType ( \Classes\Db\Column::TypePHP )?>) $this-><?=$column->getName()?>; |
|
121 | + return (<?=$column->getType(\Classes\Db\Column::TypePHP)?>) $this-><?=$column->getName()?>; |
|
122 | 122 | } |
123 | -<?php endforeach;?> |
|
123 | +<?php endforeach; ?> |
|
124 | 124 | } |
125 | 125 | \ No newline at end of file |