-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks.php
34 lines (26 loc) · 851 Bytes
/
tasks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#! /usr/bin/env php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
use Acme\ShowCommand;
use Symfony\Component\Console\Application;
use Acme\DatabaseAdapter;
use Acme\AddCommand;
use Acme\CompleteCommand;
require "vendor/autoload.php";
$app = new Application("Task App Demo", "1.0");
try{
$pdo = new PDO('sqlite:db.sqlite');
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(Exception $e){
echo $e->getMessage();
}
$dbAdapter = new DatabaseAdapter($pdo);
$app->add(new ShowCommand($dbAdapter));
$app->add(new AddCommand($dbAdapter));
$app->add(new CompleteCommand($dbAdapter));
$app->run();