Exemplo n.º 1
0
 public function deleteByCategoryId($id)
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $stmt = $pdo->prepare('DELETE FROM jobs WHERE category_id = :id');
     $result = $stmt->execute(['id' => $id]);
     return $result;
 }
Exemplo n.º 2
0
 public function getByEmail($email)
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $stmt = $pdo->prepare('SELECT * FROM admins WHERE email = :email LIMIT 1');
     $result = $stmt->execute(['email' => $email]);
     if ($result) {
         $admin = $stmt->fetch();
         $a = new Admin();
         $a->fill($admin);
         return $a;
     }
     return null;
 }
Exemplo n.º 3
0
 public function getById($id)
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $stmt = $pdo->prepare('SELECT * FROM categories WHERE id = :id LIMIT 1');
     $result = $stmt->execute(['id' => $id]);
     if ($result) {
         $category = $stmt->fetch();
         $c = new Category();
         $c->fill($category);
         return $c;
     }
     return null;
 }
Exemplo n.º 4
0
 public function getByJobId($id)
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $stmt = $pdo->prepare('SELECT * FROM applications WHERE job_id = :id');
     $stmt->execute(['id' => $id]);
     $_applications = $stmt->fetchAll();
     $applications = [];
     foreach ($_applications as $_application) {
         $a = new Application();
         $a->fill($_application);
         $applications[] = $a;
     }
     return $applications;
 }
Exemplo n.º 5
0
 public function testCanGetPdo()
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $this->assertTrue($pdo instanceof PDO);
 }