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