示例#1
0
 /**
  * Insert the model states
  *
  * @param KObjectMixable $mixer
  */
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     if ($mixer instanceof KModelDatabase) {
         foreach ($this->_columns as $name => $filter) {
             $mixer->getState()->insert($name, $filter);
         }
     }
 }
示例#2
0
 /**
  * Insert the model states
  *
  * @param KObjectMixable $mixer
  */
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     if ($mixer instanceof KModelDatabase) {
         $table = $mixer->getTable();
         // Set the dynamic states based on the unique table keys
         foreach ($table->getUniqueColumns() as $key => $column) {
             $mixer->getState()->insert($key, $column->filter, null, true, $table->mapColumns($column->related, true));
         }
     }
 }
示例#3
0
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     if ($mixer instanceof KModelDatabase) {
         $state = $mixer->getState();
         if (!isset($state->parent_id)) {
             $state->insert('parent_id', 'int');
         }
         if (!isset($state->level)) {
             $state->insert('level', 'int');
         }
         if (!isset($state->max_level)) {
             $state->insert('max_level', 'int');
         }
         if (!isset($state->include_self)) {
             $state->insert('include_self', 'boolean', false);
         }
         $state->setProperty('sort', 'default', 'title');
         return true;
     } else {
         return false;
     }
 }
 /**
  * Insert the model states
  *
  * @param KObjectMixable $mixer
  */
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     $mixer->getState()->insert('search', 'string');
 }
 /**
  * Insert the model states
  *
  * @param KObjectMixable $mixer
  */
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     $mixer->getState()->insert('limit', 'int')->insert('offset', 'int');
 }
示例#6
0
 /**
  * Insert the model states
  *
  * @param KObjectMixable $mixer
  */
 public function onMixin(KObjectMixable $mixer)
 {
     parent::onMixin($mixer);
     $mixer->getState()->insert('sort', 'cmd')->insert('direction', 'word', 'asc');
 }