1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Repositories\Finders\SimpleFinderFactory |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Repositories\Finders; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Repositories\FinderAwareRepositoryInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Factory implementations for simple finder instances. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
31
|
|
|
* @link https://github.com/techdivision/import |
32
|
|
|
* @link http://www.techdivision.com |
33
|
|
|
*/ |
34
|
|
|
class SimpleFinderFactory implements FinderFactoryInterface |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Initialize's and return's a new finder instance. |
39
|
|
|
* |
40
|
|
|
* @param \TechDivision\Import\Repositories\FinderAwareRepositoryInterface $repository The repository instance to create the finder for |
41
|
|
|
* @param string $key The key of the prepared statement |
42
|
|
|
* |
43
|
|
|
* @return \TechDivision\Import\Repositories\Finders\FinderInterface The finder instance |
44
|
|
|
*/ |
45
|
|
|
public function createFinder(FinderAwareRepositoryInterface $repository, $key) |
46
|
|
|
{ |
47
|
|
|
return new SimpleFinder( |
48
|
|
|
$repository->getConnection()->prepare( |
49
|
|
|
$repository->loadStatement($key) |
50
|
|
|
), |
51
|
|
|
$key, |
52
|
|
|
$repository->getPrimaryKeyName(), |
53
|
|
|
$repository->getEntityName() |
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|