public function create($data = array()) { $obj = parent::create($data); $obj['created'] = date("Y-m-d H:i:s"); $obj['priority'] = $this->nextPriority(); return $obj; }
public function __construct() { parent::__construct(); // todo: psr0 need verify $this->classname = 'fx_infoblock_visual'; $this->json_encode = array('wrapper_visual', 'template_visual'); $this->order('priority'); }
public function getById($id) { if (is_numeric($id)) { return parent::getById($id); } if (preg_match("~fake~", $id)) { return $this->create(array('id' => $id)); } }
public function getEntityClassName($data) { $parts = explode('.', $data['keyword']); list($vendor, $module) = $parts; $class = fx::util()->underscoreToCamel($vendor) . "\\" . fx::util()->underscoreToCamel($module) . "\\Module"; if (class_exists($class)) { return $class; } return parent::getEntityClassName(); }
public static function dropStoredStaticCache() { fx::data('component')->dropStoredStaticCache(); parent::dropStoredStaticCache(); }
public static function dropStoredStaticCache() { parent::dropStoredStaticCache(); fx::cache('meta')->delete('schema'); }
public function delete($cond_field = null, $cond_val = null) { if (func_num_args() === 0) { parent::delete(); } if ($cond_field != 'id' || !is_numeric($cond_val)) { throw new Exception("Content can be killed only by id!"); } $tables = $this->getTables(); $q = 'DELETE {{' . join("}}, {{", $tables) . '}} '; $q .= 'FROM {{' . join("}} INNER JOIN {{", $tables) . '}} '; $q .= ' WHERE '; $base_table = array_shift($tables); foreach ($tables as $t) { $q .= ' {{' . $t . '}}.id = {{' . $base_table . '}}.id AND '; } $q .= ' {{' . $base_table . '}}.id = "' . fx::db()->escape($cond_val) . '"'; fx::db()->query($q); }