/** * Fetches product's data by its associated id * * @param string $id Product id * @param boolean $junction Whether to grab meta information about its categories * @return array */ public function fetchById($id, $junction = true) { $db = $this->db->select('*')->from(self::getTableName())->whereEquals('id', $id)->andWhereEquals('published', '1'); if ($junction === true) { $db->asManyToMany('categories', self::getJunctionTableName(), self::PARAM_JUNCTION_MASTER_COLUMN, CategoryMapper::getTableName(), 'id', array('id', 'name')); } return $db->query(); }
/** * {@inheritDoc} */ protected function getTables() { return array(CategoryMapper::getTableName(), ImageMapper::getTableName(), OrderInfoMapper::getTableName(), OrderProductMapper::getTableName(), ProductMapper::getTableName(), ProductMapper::getJunctionTableName()); }