Overview

Namespaces

  • Datadepo
    • Api
      • DataStores
      • Structures
      • Synchronizers

Classes

  • Datadepo\Api\ApiWrapper
  • Datadepo\Api\Collector
  • Datadepo\Api\DataDepoResponse
  • Datadepo\Api\DataDepoSync
  • Datadepo\Api\DataStores\PdoDataStore
  • Datadepo\Api\IniConfiguration
  • Datadepo\Api\RunningFiles
  • Datadepo\Api\Structures\AbstractStructure
  • Datadepo\Api\Structures\BusinessLine
  • Datadepo\Api\Structures\BusinessSupplierLine
  • Datadepo\Api\Structures\CategoryLine
  • Datadepo\Api\Structures\DataLine
  • Datadepo\Api\Structures\ImageLine
  • Datadepo\Api\Structures\ParameterLine
  • Datadepo\Api\Structures\PriceLine
  • Datadepo\Api\Structures\RelatedLine
  • Datadepo\Api\Structures\StoreLine
  • Datadepo\Api\Structures\SupplierBankAccountLine
  • Datadepo\Api\Structures\SupplierLine
  • Datadepo\Api\Structures\SupplierPersonLine
  • Datadepo\Api\Structures\VariantLine
  • Datadepo\Api\Synchronizers\AbstractSynchronizer
  • Datadepo\Api\Synchronizers\BusinessSynchronizer
  • Datadepo\Api\Synchronizers\CategorySynchronizer
  • Datadepo\Api\Synchronizers\DataSynchronizer
  • Datadepo\Api\Synchronizers\SuppliersSynchronizer

Interfaces

  • Datadepo\Api\DataStores\IDataStore

Exceptions

  • Datadepo\Api\ApiException
  • Datadepo\Api\ConfigurationException
  • Datadepo\Api\DataDepoRunningException
  • Datadepo\Api\DataDepoSuspendedException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace Datadepo\Api;
 3: 
 4: class DataDepoSync
 5: {
 6:   
 7:   /** @var IniConfiguration */
 8:   protected $iniConfiguration;
 9:   
10:   /** @var DataStores\IDataStore */
11:   protected $dataStore;
12:   
13:   
14:   /** @var bool */
15:   private $dataStoreConnected = FALSE;
16:   
17:   /**
18:    * @param DataStores\IDataStore $dataStore
19:    * @param IniConfiguration $iniConfiguration
20:    */
21:   public function __construct(DataStores\IDataStore $dataStore, IniConfiguration $iniConfiguration)
22:   {
23:     $this->dataStore = $dataStore;
24:     $this->iniConfiguration = $iniConfiguration;
25:   }
26:   
27:   /**
28:    * Sync data (identificators, names, descriptions, parameters, images)
29:    * @return DataDepoResponse
30:    */
31:   public function data()
32:   {
33:     return $this->synchronize(new Synchronizers\DataSynchronizer($this->dataStore, $this->iniConfiguration));
34:   }
35:   
36:   /**
37:    * Sync business (suppliers, prices, store, variants)
38:    * @return DatadepoResponse
39:    */
40:   public function business()
41:   {
42:     return $this->synchronize(new Synchronizers\BusinessSynchronizer($this->dataStore, $this->iniConfiguration));
43:   }
44:   
45:   /**
46:    * Sync suppliers (invoice data, persons, bank accounts etc ...)
47:    * @return DatadepoResponse
48:    */
49:   public function suppliers()
50:   {
51:     return $this->synchronize(new Synchronizers\SuppliersSynchronizer($this->dataStore, $this->iniConfiguration));
52:   }
53:   
54:   /**
55:    * Sync categories tree (names, paths, depends etc ...)
56:    * @return DatadepoResponse
57:    */
58:   public function categories()
59:   {
60:     return $this->synchronize(new Synchronizers\CategorySynchronizer($this->dataStore, $this->iniConfiguration));
61:   }
62:   
63:   /**
64:    * @param Synchronizers\AbstractSynchronizer $synchronizer
65:    * @return DataDepoResponse
66:    */
67:   protected function synchronize(Synchronizers\AbstractSynchronizer $synchronizer)
68:   {
69:     $this->connect();
70:     return $synchronizer->sync();
71:   }
72:   
73:   
74:   /**
75:    */
76:   protected function connect()
77:   {
78:     if (!$this->dataStoreConnected) {
79:       $this->dataStore->setIniConfiguration($this->iniConfiguration);
80:       $this->dataStore->connect();
81:     }
82:   }
83:   
84:   
85: }
API documentation generated by ApiGen