/** * Returns a new source as outer join of this and the given source. * @param Source $source * @param Condition $condition * @return Join */ function OuterJoin(Table $table, Condition $condition, $prepend = false) { return $this->Join($table, JoinType::Outer(), $condition, $prepend); }
/** * Gets the content's member groups * @param Content $content * @return Membergroup[] Returns the member groups assigned to the content */ static function ContentMembergroups(Content $content) { if (!$content->Exists()) { return array(); } $sql = Access::SqlBuilder(); $tblCmg = ContentMembergroup::Schema()->Table(); $tblMg = Membergroup::Schema()->Table(); $join = $sql->Join($tblCmg); $joinCondition = $sql->Equals($tblCmg->Field('MemberGroup'), $tblMg->Field('ID')); $where = $sql->Equals($tblCmg->Field('Content'), $sql->Value($content->GetID())); $orderBy = $sql->OrderList($sql->OrderAsc($tblMg->Field('Name'))); return Membergroup::Schema()->Fetch(false, $where, $orderBy, null, 0, null, $join, JoinType::Inner(), $joinCondition); }
/** * The last log item that is directly related to the template * @param Content $content The content * @return LogItem Returns the log item */ static function LastTemplateLog($moduleType, $template) { $tblLogTemplate = \Phine\Database\Core\LogTemplate::Schema()->Table(); $tblLogItem = LogItem::Schema()->Table(); $sql = Access::SqlBuilder(); $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed'))); $joinCond = $sql->Equals($tblLogTemplate->Field('LogItem'), $tblLogItem->Field('ID')); $where = $sql->Equals($tblLogTemplate->Field('Template'), $sql->Value($template))->And_($sql->Equals($tblLogTemplate->Field('ModuleType'), $moduleType)); return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogTemplate), JoinType::Inner(), $joinCond); }