_idBanner = (int) $idBanner; return $this; } public function getIdBanner() { return $this->_idBanner; } protected function _initBanner() { if (null == $this->_bannerObj) { $this->_bannerObj = new App_Banner_AdminObj(); $this->_bannerObj->setPrimaryKey($this->_idBanner); $this->_bannerObj->initData(); self::$_bannerData = $this->_bannerObj->getData(); if (!empty(self::$_bannerData)) { self::$_bannerData['width'] = $this->_bannerObj->imageWidth; self::$_bannerData['height'] = $this->_bannerObj->imageHeight; } } return $this; } public function getBannerImage() { $this->_initBanner(); $image = ''; if (!empty(self::$_bannerData)) { $image = self::$_bannerData['image']; } return $image; } public function getBannerTitle() { $this->_initBanner(); $title = ''; if (!empty(self::$_bannerData)) { $title = self::$_bannerData['title']; } return $title; } public function getBannerData($field = false) { $data = array(); $this->_initBanner(); if (!empty(self::$_bannerData)) { $data = self::$_bannerData; } return Qs_Array::get($data, $field); } protected function _getFromDb($key) { $select = $this->_getSelect(); $select->reset(); $select->from(array($this->_tableAlias => $this->_getTableName()), '*') ->where("{$this->_tableAlias}.idBanner = ?", (int) $this->getIdBanner()); $statement = $select->query(); $rows = $statement->fetchAll(); if (count($rows)) { return $rows; } return false; } public function getData($field = false, $forceFromDb = false) { if ($forceFromDb || null === $this->_data) { $this->_data = $this->_getFromDb($this->getPrimaryKey()); if (!$this->_data) { $this->_data = null; } } return Qs_Array::get($this->_data, $field); } }