1 | <?php |
||
14 | class ZohoSyncDatabaseCommand extends Command |
||
15 | { |
||
16 | /** |
||
17 | * The list of Zoho DAOs to copy. |
||
18 | * |
||
19 | * @var AbstractZohoDao[] |
||
20 | */ |
||
21 | private $zohoDaos; |
||
22 | |||
23 | /** |
||
24 | * @var ZohoDatabaseModelSync |
||
25 | */ |
||
26 | private $zohoDatabaseModelSync; |
||
27 | |||
28 | /** |
||
29 | * @var ZohoDatabaseCopier |
||
30 | */ |
||
31 | private $zohoDatabaseCopier; |
||
32 | |||
33 | /** |
||
34 | * @var ZohoDatabasePusher |
||
35 | */ |
||
36 | private $zohoDatabaseSync; |
||
37 | |||
38 | /** |
||
39 | * @var Lock |
||
40 | */ |
||
41 | private $lock; |
||
42 | |||
43 | /** |
||
44 | * @param ZohoDatabaseModelSync $zohoDatabaseModelSync |
||
45 | * @param ZohoDatabaseCopier $zohoDatabaseCopier |
||
46 | * @param ZohoDatabasePusher $zohoDatabaseSync |
||
47 | * @param AbstractZohoDao[] $zohoDaos The list of Zoho DAOs to copy |
||
48 | * @param Lock $lock A lock that can be used to avoid running the same command (copy) twice at the same time |
||
49 | */ |
||
50 | public function __construct(ZohoDatabaseModelSync $zohoDatabaseModelSync, ZohoDatabaseCopier $zohoDatabaseCopier, ZohoDatabasePusher $zohoDatabaseSync, array $zohoDaos, Lock $lock = null) |
||
59 | |||
60 | protected function configure() |
||
70 | |||
71 | protected function execute(InputInterface $input, OutputInterface $output) |
||
96 | |||
97 | /** |
||
98 | * Sychronizes the model of the database with Zoho records. |
||
99 | * |
||
100 | * @param OutputInterface $output |
||
101 | */ |
||
102 | private function syncModel(InputInterface $input, OutputInterface $output) |
||
115 | |||
116 | /** |
||
117 | * Run the fetch Db command. |
||
118 | * |
||
119 | * @param InputInterface $input |
||
120 | * @param OutputInterface $output |
||
121 | */ |
||
122 | private function fetchDb(InputInterface $input, OutputInterface $output) |
||
140 | |||
141 | /** |
||
142 | * Run the push Db command. |
||
143 | * |
||
144 | * @param OutputInterface $output |
||
145 | */ |
||
146 | private function pushDb(OutputInterface $output) |
||
156 | } |
||
157 |