1 | <?php |
||
7 | abstract class Command |
||
8 | { |
||
9 | protected $connection; |
||
10 | protected $dispatcher; |
||
11 | |||
12 | /** |
||
13 | * Execute query. |
||
14 | * |
||
15 | * @return integer |
||
16 | */ |
||
17 | public function execute() |
||
25 | |||
26 | /** |
||
27 | * Set an event dispatcher. |
||
28 | * |
||
29 | * @param EventDispatcher $dispatcher EventDispatcher instance. |
||
30 | * |
||
31 | * @return Command |
||
32 | */ |
||
33 | public function setEventDispatcher(EventDispatcher $dispatcher) |
||
39 | |||
40 | /** |
||
41 | * Set the connection. |
||
42 | * |
||
43 | * @param Connection $connection Connection instance. |
||
44 | * |
||
45 | * @return Command |
||
46 | */ |
||
47 | public function setConnection(Connection $connection) |
||
53 | |||
54 | /** |
||
55 | * Execute actions before execute query. |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | protected function preExecute() |
||
62 | |||
63 | /** |
||
64 | * Execute actions after execute query. |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | protected function postExecute() |
||
71 | |||
72 | /** |
||
73 | * Get sql query to execute. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | abstract public function getSql(); |
||
78 | } |
||
79 |