[ 'type' => Schema::DT_VARCHAR128, 'nullable' => false, 'default' => '' ], 'description' => [ 'type' => Schema::DT_TEXT ], 'sizeFactor' => [ 'type' => Schema::DT_INT, 'nullable' => false, 'default' => 0 ], 'stationCount' => [ 'type' => Schema::DT_INT, 'nullable' => false, 'default' => 0 ], 'stationSystemCount' => [ 'type' => Schema::DT_INT, 'nullable' => false, 'default' => 0 ], 'systems' => [ 'has-many' => ['Model\Universe\SystemModel', 'factionId'] ] ]; /** * get data * @return \stdClass */ public function getData(){ $factionData = (object) []; $factionData->id = $this->_id; $factionData->name = $this->name; return $factionData; } /** * @param int $id * @param string $accessToken * @param array $additionalOptions */ protected function loadData(int $id, string $accessToken = '', array $additionalOptions = []){ $data = self::getF3()->ccpClient()->getUniverseFactionData($id); if(!empty($data)){ $this->copyfrom($data, ['id', 'name', 'description', 'sizeFactor', 'stationCount', 'stationSystemCount']); $this->save(); } } }