Beispiel #1
0
 public function runSetup()
 {
     if ($this->options['foreign_key'] == null) {
         $this->options['foreign_key'] = Text::singularize($this->setupTable) . '_id';
     }
     if ($this->options['local_key'] == null) {
         $this->options['local_key'] = $this->setupPrimaryKey[0];
     }
 }
 public function runSetup()
 {
     $model = InjectionContainer::resolve(Nibii::getClassName($this->options['model'], self::BELONGS_TO));
     if ($this->options['foreign_key'] == null) {
         $this->options['foreign_key'] = $model->getDescription()->getPrimaryKey()[0];
     }
     if ($this->options['local_key'] == null) {
         $this->options['local_key'] = Text::singularize($model->getTable()) . '_id';
     }
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $this->addOperation('edit');
     $this->addOperation('delete');
     TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/crud'));
     TemplateEngine::appendPath(realpath(__DIR__ . '/../../views/forms'));
     View::set('entities', $this->getWyfName());
     View::set('entity', Text::singularize($this->getWyfName()));
     View::set('has_add_operation', true);
     View::set('form_template', str_replace('.', '_', $this->getWyfPackage()) . '_form');
 }
 public function runSetup()
 {
     if (isset($this->options['through'])) {
         $junctionModelName = $this->options['through'];
     } else {
         $junctionModelName = Nibii::joinModels($this->setupName, $this->options['model']);
     }
     $this->options['junction_model'] = $junctionModelName;
     $foreignModel = Nibii::load($this->options['model']);
     if ($this->options['foreign_key'] == null) {
         $this->options['foreign_key'] = $foreignModel->getDescription()->getPrimaryKey()[0];
     }
     if ($this->options['local_key'] == null) {
         $this->options['local_key'] = $this->setupPrimaryKey[0];
     }
     if (!isset($this->options['junction_local_key'])) {
         $this->options['junction_local_key'] = Text::singularize($this->setupTable) . '_id';
     }
     if (!isset($this->options['junction_foreign_key'])) {
         $this->options['junction_foreign_key'] = Text::singularize($foreignModel->getTable()) . '_id';
     }
 }