Ejemplo n.º 1
0
 /**
  * The last log item that is directly related to the container
  * @param Container $container The container
  * @return LogItem Returns the log item
  */
 static function LastContainerLog(Container $container)
 {
     $tblLogContainer = LogContainer::Schema()->Table();
     $tblLogItem = LogItem::Schema()->Table();
     $sql = Access::SqlBuilder();
     $orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
     $joinCond = $sql->Equals($tblLogContainer->Field('LogItem'), $tblLogItem->Field('ID'));
     $where = $sql->Equals($tblLogContainer->Field('Container'), $sql->Value($container->GetID()));
     return LogItem::Schema()->First($where, $orderBy, null, $sql->Join($tblLogContainer), JoinType::Inner(), $joinCond);
 }