/**
  * 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);
 }
Esempio n. 2
0
 public function __construct()
 {
     parent::__construct();
 }
Esempio n. 3
0
 public function _initialize()
 {
     parent::_initialize();
     //取缓存的Key前缀
     $this->mcPrefix = 'Config::';
 }
Esempio n. 4
0
 public function _initialize()
 {
     parent::_initialize();
     $this->mcPrefix = 'Menu::';
     $this->mcEnable = false;
 }
Esempio n. 5
0
 /**
  * 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;
 }
Esempio n. 6
0
 public function _initialize()
 {
     parent::_initialize();
     $this->mcPrefix = 'Useradmin::';
 }
Esempio n. 7
0
 public function _initialize()
 {
     parent::_initialize();
     $this->sqlMap = array('ip' => get_client_ip(), 'createtime' => time());
 }