/** * 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); } } }
/** * 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)); } } }
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'); }
/** * Insert the model states * * @param KObjectMixable $mixer */ public function onMixin(KObjectMixable $mixer) { parent::onMixin($mixer); $mixer->getState()->insert('sort', 'cmd')->insert('direction', 'word', 'asc'); }