| @@ 32-109 (lines=78) @@ | ||
| 29 | * @link https://github.com/techdivision/import |
|
| 30 | * @link http://www.techdivision.com |
|
| 31 | */ |
|
| 32 | abstract class AbstractProcessor implements ProcessorInterface |
|
| 33 | { |
|
| 34 | ||
| 35 | /** |
|
| 36 | * The utility class name with the SQL statements to use. |
|
| 37 | * |
|
| 38 | * @var string |
|
| 39 | */ |
|
| 40 | protected $utilityClassName; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * The PDO connection instance. |
|
| 44 | * |
|
| 45 | * @var \PDO |
|
| 46 | */ |
|
| 47 | protected $connection; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Initialize the processor with the passed connection and utility class name. |
|
| 51 | * . |
|
| 52 | * @param \PDO $connection The PDO connection instance |
|
| 53 | * @param string $utilityClassName The utility class name |
|
| 54 | */ |
|
| 55 | public function __construct(\PDO $connection, $utilityClassName) |
|
| 56 | { |
|
| 57 | ||
| 58 | // set the passed instances |
|
| 59 | $this->setConnection($connection); |
|
| 60 | $this->setUtilityClassName($utilityClassName); |
|
| 61 | ||
| 62 | // initialize the instance |
|
| 63 | $this->init(); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Set's the passed utility class with the SQL statements to use. |
|
| 68 | * |
|
| 69 | * @param string $utilityClassName The utility class name |
|
| 70 | * |
|
| 71 | * @return void |
|
| 72 | */ |
|
| 73 | public function setUtilityClassName($utilityClassName) |
|
| 74 | { |
|
| 75 | $this->utilityClassName = $utilityClassName; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Return's the utility class with the SQL statements to use. |
|
| 80 | * |
|
| 81 | * @return string The utility class name |
|
| 82 | */ |
|
| 83 | public function getUtilityClassName() |
|
| 84 | { |
|
| 85 | return $this->utilityClassName; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Sets's the initialized PDO connection. |
|
| 90 | * |
|
| 91 | * @param \PDO $connection The initialized PDO connection |
|
| 92 | * |
|
| 93 | * @return void |
|
| 94 | */ |
|
| 95 | public function setConnection(\PDO $connection) |
|
| 96 | { |
|
| 97 | $this->connection = $connection; |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Return's the initialized PDO connection. |
|
| 102 | * |
|
| 103 | * @return \PDO The initialized PDO connection |
|
| 104 | */ |
|
| 105 | public function getConnection() |
|
| 106 | { |
|
| 107 | return $this->connection; |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||
| @@ 32-109 (lines=78) @@ | ||
| 29 | * @link https://github.com/techdivision/import |
|
| 30 | * @link http://www.techdivision.com |
|
| 31 | */ |
|
| 32 | abstract class AbstractRepository |
|
| 33 | { |
|
| 34 | ||
| 35 | /** |
|
| 36 | * The utility class name with the SQL statements to use. |
|
| 37 | * |
|
| 38 | * @var string |
|
| 39 | */ |
|
| 40 | protected $utilityClassName; |
|
| 41 | ||
| 42 | /** |
|
| 43 | * The PDO connection instance. |
|
| 44 | * . |
|
| 45 | * @var \PDO |
|
| 46 | */ |
|
| 47 | protected $connection; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Initialize the repository with the passed connection and utility class name. |
|
| 51 | * . |
|
| 52 | * @param \PDO $connection The PDO connection instance |
|
| 53 | * @param string $utilityClassName The utility class name |
|
| 54 | */ |
|
| 55 | public function __construct(\PDO $connection, $utilityClassName) |
|
| 56 | { |
|
| 57 | ||
| 58 | // set the passed instances |
|
| 59 | $this->setConnection($connection); |
|
| 60 | $this->setUtilityClassName($utilityClassName); |
|
| 61 | ||
| 62 | // initialize the instance |
|
| 63 | $this->init(); |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * Set's the passed utility class with the SQL statements to use. |
|
| 68 | * |
|
| 69 | * @param string $utilityClassName The utility class name |
|
| 70 | * |
|
| 71 | * @return void |
|
| 72 | */ |
|
| 73 | public function setUtilityClassName($utilityClassName) |
|
| 74 | { |
|
| 75 | $this->utilityClassName = $utilityClassName; |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Return's the utility class with the SQL statements to use. |
|
| 80 | * |
|
| 81 | * @return string The utility class name |
|
| 82 | */ |
|
| 83 | public function getUtilityClassName() |
|
| 84 | { |
|
| 85 | return $this->utilityClassName; |
|
| 86 | } |
|
| 87 | ||
| 88 | /** |
|
| 89 | * Set's the initialized PDO connection. |
|
| 90 | * . |
|
| 91 | * @param \PDO $connection The PDO connection instance |
|
| 92 | * |
|
| 93 | * @return void |
|
| 94 | */ |
|
| 95 | public function setConnection(\PDO $connection) |
|
| 96 | { |
|
| 97 | $this->connection = $connection; |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Return's the initialized PDO connection. |
|
| 102 | * |
|
| 103 | * @return \PDO The initialized PDO connection |
|
| 104 | */ |
|
| 105 | public function getConnection() |
|
| 106 | { |
|
| 107 | return $this->connection; |
|
| 108 | } |
|
| 109 | } |
|
| 110 | ||