use CubistMagicAttribute;
/**
- * @var array
+ * @var CubistMagicField[]
*/
protected $_fields = [];
'SINGULAR' => $this->getOption('singular', $this->getOption('name')),
'PLURAL' => $this->getOption('plural', ''),
'MODELNAMESPACE' => get_class($this),
- 'FIELDS' => var_export($this->_fields, true)
+ 'FIELDS' => var_export($this->getFieldsDefinitions(), true)
];
$res = file_get_contents($stub);
file_put_contents($dest, $res);
}
+ public function getFieldsDefinitions()
+ {
+ $res = [];
+ foreach ($this->_fields as $name => $field) {
+ $res[] = $field->getDefinition();
+ }
+ return $res;
+ }
+
protected function _getStubPath()
{
return __DIR__ . '/../../../resources/cubistmagic/';