Beispiel #1
0
 public function execute()
 {
     $app = \App::getInstance();
     $em = new \Archive\Port\Adaptor\Persistence\PDO\LinkEntityManager();
     $link = $em->create($app->REQUEST);
     return $link;
 }
 public function lastmod($id = null)
 {
     $app = \App::getInstance();
     $conn = $app->DB_CONNECT;
     $sth = $conn->prepare("SELECT UNIX_TIMESTAMP(`updated`) as `lastmod` FROM `resources` ORDER BY `updated` DESC LIMIT 0,1;");
     $sth->execute(array());
     $row = $sth->fetch();
     $em = new \Archive\Port\Adaptor\Persistence\PDO\LinkEntityManager();
     return max($row["lastmod"], $em->lastmod($id));
 }
Beispiel #3
0
 public function execute($id)
 {
     $app = \App::getInstance();
     $em = new \Archive\Port\Adaptor\Persistence\PDO\LinkEntityManager();
     if ($link = $em->findById($id)) {
         return $link;
     } else {
         $app->throwError(new \Exception("Link {$id} not found", 404));
     }
 }
Beispiel #4
0
 public function execute($id)
 {
     $app = \App::getInstance();
     $em = new \Archive\Port\Adaptor\Persistence\PDO\LinkEntityManager();
     if ($link = $em->findById($id)) {
         try {
             $conn = $app->DB_CONNECT;
             $conn->beginTransaction();
             $link = $em->update($link, $app->REQUEST);
             $conn->commit();
             return $link;
         } catch (\Exception $e) {
             $conn->rollback();
             $app->throwError($e);
         }
     } else {
         $app->throwError(new \Exception("Link {$id} not found", 404));
     }
 }