Exemplo n.º 1
0
 /**
  * Reports a container action with dependencies to the log
  * @param Container $container The container being manipulated
  * @param Enums\Action $action The operation executed on the container
  */
 function ReportContainerAction(Container $container, Enums\Action $action)
 {
     $logItem = $this->CreateLogItem(Enums\ObjectType::Container(), $action);
     if (!$action->Equals(Enums\Action::Delete())) {
         $logContainer = new LogContainer();
         $logContainer->SetContainer($container);
         $logContainer->SetLogItem($logItem);
         $logContainer->Save();
     }
 }
Exemplo n.º 2
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);
 }