public function getTweets() { $entity_id = $this->_entity->getId(); $entity_tbl = $this->_entity->getTbl(); $select = new Select('tweet'); $select->addField('date'); $select->addField('msg'); $select->inner_join('id_tweet', Select::construct("r_{$entity_tbl}_tweet")); $select->where(array("b.{$entity_id} = ?" => $this->getId())); $select->order_by('date DESC'); $result = $this->_dao->select($select); return $result; }
/** * * @param String $id * @return String/Json */ public function getAjaxCurrent($id) { $ce_tbl = $this->_current_entity->getTbl(); $ce_id = $this->_current_entity->getId(); $fe_tbl = $this->_foreign_entity->getTbl(); $fe_id = $this->_foreign_entity->getId(); $fe_title = $this->_foreign_entity->getTitle(); $tableRelationship = "r_{$ce_tbl}_{$fe_tbl}"; $arrCriteria["{$ce_id} = ?"] = $id; if ($this->_foreign_entity->hasTrash()) { $arrCriteria['is_del = ?'] = '0'; } $select = new Select($fe_tbl); $select->addField($fe_id, 'id'); $select->addField($fe_title, 'text'); $select->inner_join($fe_id, Select::construct($tableRelationship)); $select->where($arrCriteria); $select->order_by('b.sequence'); $result = $this->_dao->select($select); return $result; }