/** * Return the json formatted string based on decorator settings * @return mixed|string */ public function getResult() { $json = $this->object->toJsonEncodeable(); if (!$this->showEmpty) { $json = $this->removeEmpty($json); } if (!$this->showType) { $json = $this->removeType($json); } if ($this->dataGroup) { $output = new \stdClass(); $group = $this->dataGroup; if (!empty($this->extraInfo) && is_array($this->extraInfo)) { foreach ($this->extraInfo as $key => $value) { if ($key === $group) { continue; } $output->{$key} = $value; } } $output->{$group} = $json; } else { if (!empty($this->extraInfo) && is_array($this->extraInfo)) { $output = new \stdClass(); foreach ($this->extraInfo as $key => $value) { if ($key === "body") { continue; } $output->{$key} = $value; } $output->body = $json; } else { $output = $json; } } return json_encode($output, $this->jsonOptions); }
public function __construct() { parent::__construct(); }
public function _initialize() { parent::_initialize(); //取缓存的Key前缀 $this->mcPrefix = 'Config::'; }
public function _initialize() { parent::_initialize(); $this->mcPrefix = 'Menu::'; $this->mcEnable = false; }
/** * Map a Mysql Database row the the model instance populating it based on * look ups of matching column in many cases it may be beneficial for the child adapter to override this * * @param \stdClass * @param \Common\Model\BaseModel * @return \Common\Model\BaseModel */ protected function mapDBRowToModel($Row, BaseModel $Model) { if (!empty($Row->Data)) { $Model->populateFromJson($Row->Data); } foreach ($Row as $field => $value) { $column = $this->lookupModelColumn($Model, $field); if ($column) { $Model->{$column} = $value; } } return $Model; }
public function _initialize() { parent::_initialize(); $this->mcPrefix = 'Useradmin::'; }
public function _initialize() { parent::_initialize(); $this->sqlMap = array('ip' => get_client_ip(), 'createtime' => time()); }