示例#1
0
 /**
  * Creates an object from the specified table and row.
  *
  * @param  string|\Rougin\Wildfire\CodeigniterModel $table
  * @param  object                                   $row
  * @return array
  */
 protected function createObject($table, $row)
 {
     list($tableName, $model) = ModelHelper::createInstance($table);
     $properties = ['belongs_to' => [], 'columns' => [], 'hidden' => []];
     if ($model instanceof CodeigniterModel) {
         $properties = $model->getProperties();
         $properties = $model->getRelationshipProperties($properties);
     }
     $tableInfo = $this->describe->getTable($tableName);
     $this->setModelFields($model, $row, $properties, $tableInfo);
     return $model;
 }
示例#2
0
 /**
  * Sets the query and table properties.
  *
  * @param  string|object $table
  * @return void
  */
 protected function setQueryAndTable($table)
 {
     list($tableName, $model) = ModelHelper::createInstance($table);
     $this->table = $tableName;
     if ($this->query == null) {
         $this->query = $this->db->get($tableName);
     }
     if ($model == $table) {
         $this->table = $model;
     }
     return;
 }