/** * 初期処理 */ protected function init() { $this->table = $this->getServiceLocator()->get($this->table_name . 'Table'); #region 初期設定 if ($this->mode == 'update') { $this->record = $this->table->findByPrimaryKey($this->getParams()); if ($this->record) { $this->record->exchangeUpdateArray($this->getParams()); } } else { $this->record = $this->getServiceLocator()->get($this->table_name . 'Model'); $this->record->exchangeArray($this->getParams()); } #endregion }
/** * ログイン情報取得 * * @return AbstractModel */ public function getLoginUser() { // ログイン確認 if ($this->auth->hasIdentity()) { // ログイン情報を取得する $identity = $this->auth->getIdentity(); $keys = []; foreach ($this->table->getPrimaryKeys() as $key) { $keys[$key] = $identity[$key]; } return $this->table->findByPrimaryKey($keys); } return false; }
/** * 初期処理 */ protected function init() { $this->table = $this->getServiceLocator()->get($this->table_name . 'Table'); $this->record = $this->table->findByPrimaryKey($this->getParams()); }