CollectionSyncService.php
1 year ago
CustomerSyncService.php
1 year ago
PostSyncService.php
1 year ago
ProductSyncService.php
1 year ago
ProductsSyncProcess.php
1 year ago
ProductsSyncService.php
1 year ago
StoreSyncService.php
1 year ago
SyncService.php
1 year ago
SyncServiceProvider.php
1 year ago
SyncServiceProvider.php
61 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Sync; |
| 4 | |
| 5 | use SureCart\Sync\CollectionSyncService; |
| 6 | use SureCart\Sync\CustomerSyncService; |
| 7 | use SureCart\Sync\PostSyncService; |
| 8 | use SureCart\Sync\ProductSyncService; |
| 9 | use SureCart\Sync\ProductsSyncProcess; |
| 10 | use SureCart\Sync\ProductsSyncService; |
| 11 | use SureCart\Sync\StoreSyncService; |
| 12 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 13 | |
| 14 | /** |
| 15 | * WordPress Users service. |
| 16 | */ |
| 17 | class SyncServiceProvider implements ServiceProviderInterface { |
| 18 | /** |
| 19 | * Register all dependencies in the IoC container. |
| 20 | * |
| 21 | * @param \Pimple\Container $container Service container. |
| 22 | * @return void |
| 23 | */ |
| 24 | public function register( $container ) { |
| 25 | $app = $container[ SURECART_APPLICATION_KEY ]; |
| 26 | |
| 27 | $container['surecart.sync'] = fn ( $container ) => |
| 28 | new SyncService( $container[ SURECART_APPLICATION_KEY ] ); |
| 29 | |
| 30 | $container['surecart.sync.store'] = fn ( $container ) => |
| 31 | new StoreSyncService( $container[ SURECART_APPLICATION_KEY ] ); |
| 32 | |
| 33 | $container['surecart.sync.product'] = fn ( $container ) => |
| 34 | new ProductSyncService( $container[ SURECART_APPLICATION_KEY ] ); |
| 35 | |
| 36 | $container['surecart.sync.collection'] = fn() => new CollectionSyncService(); |
| 37 | $container['surecart.process.product_post.sync'] = fn() => new PostSyncService(); |
| 38 | $container['surecart.sync.customers'] = fn() => new CustomerSyncService(); |
| 39 | $container['surecart.sync.products'] = fn() => new ProductsSyncService( $container[ SURECART_APPLICATION_KEY ] ); |
| 40 | |
| 41 | // Queues up the products for syncing and starts sync. |
| 42 | $products_queue_process = new ProductsSyncProcess(); |
| 43 | $container['surecart.process.products.queue'] = fn() => $products_queue_process; |
| 44 | |
| 45 | $app->alias( 'sync', 'surecart.sync' ); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Bootstrap any services if needed. |
| 50 | * |
| 51 | * @param \Pimple\Container $container Service container. |
| 52 | * @return void |
| 53 | */ |
| 54 | public function bootstrap( $container ) { |
| 55 | $container['surecart.sync.product']->bootstrap(); |
| 56 | $container['surecart.sync.products']->bootstrap(); |
| 57 | $container['surecart.sync.customers']->bootstrap(); |
| 58 | $container['surecart.sync.store']->bootstrap(); |
| 59 | } |
| 60 | } |
| 61 |