예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #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;
 }
예제 #5
0
 public function testCanGetPdo()
 {
     $pdo = Config::getInstance()->get('db.pdo');
     $this->assertTrue($pdo instanceof PDO);
 }