@@ 58-76 (lines=19) @@ | ||
55 | } |
|
56 | } |
|
57 | ||
58 | protected function getSchema() |
|
59 | { |
|
60 | $schema = $this->option('schema'); |
|
61 | if(! $schema){ |
|
62 | return $this->spaces(12) . "// Schema declaration"; |
|
63 | } |
|
64 | ||
65 | $items = $schema; |
|
66 | if( ! $this->option('parsed')){ |
|
67 | $items = $this->getArgumentParser('schema')->parse($schema); |
|
68 | } |
|
69 | ||
70 | $fields = []; |
|
71 | foreach ($items as $item) { |
|
72 | $fields[] = $this->getFieldDeclaration($item); |
|
73 | } |
|
74 | ||
75 | return implode(PHP_EOL, $fields); |
|
76 | } |
|
77 | ||
78 | protected function getAdditionals() |
|
79 | { |
|
@@ 106-124 (lines=19) @@ | ||
103 | return " \$table" . implode('', $parts) . ';'; |
|
104 | } |
|
105 | ||
106 | protected function getConstraints() |
|
107 | { |
|
108 | $keys = $this->option('keys'); |
|
109 | if(! $keys){ |
|
110 | return $this->spaces(12) . "// Constraints declaration"; |
|
111 | } |
|
112 | ||
113 | $items = $keys; |
|
114 | if(! $this->option('parsed')){ |
|
115 | $items = $this->getArgumentParser('foreign-keys')->parse($keys); |
|
116 | } |
|
117 | ||
118 | $constraints = []; |
|
119 | foreach ($items as $item) { |
|
120 | $constraints[] = $this->getConstraintDeclaration($item); |
|
121 | } |
|
122 | ||
123 | return implode(PHP_EOL, $constraints); |
|
124 | } |
|
125 | ||
126 | protected function getConstraintDeclaration($key) |
|
127 | { |
@@ 132-149 (lines=18) @@ | ||
129 | return $relations; |
|
130 | } |
|
131 | ||
132 | protected function getRules() |
|
133 | { |
|
134 | $rules = $this->option('rules'); |
|
135 | if(! $rules){ |
|
136 | return " // Validation rules"; |
|
137 | } |
|
138 | $items = $rules; |
|
139 | if(! $this->option('parsed')){ |
|
140 | $items = $this->getArgumentParser('rules')->parse($rules); |
|
141 | } |
|
142 | $rules = []; |
|
143 | $template = $this->getTemplate('model/rule'); |
|
144 | foreach ($items as $item) { |
|
145 | $rules[] = $template->with($item)->get(); |
|
146 | } |
|
147 | ||
148 | return implode(PHP_EOL, $rules); |
|
149 | } |
|
150 | ||
151 | protected function getUses() |
|
152 | { |