1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Queryr\EntityStore; |
4
|
|
|
|
5
|
|
|
use Queryr\EntityStore\Data\ItemInfo; |
6
|
|
|
use Queryr\EntityStore\Data\ItemRow; |
7
|
|
|
use Queryr\EntityStore\Data\PropertyInfo; |
8
|
|
|
use Queryr\EntityStore\Data\PropertyRow; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @licence GNU GPL v2+ |
12
|
|
|
* @author Jeroen De Dauw < [email protected] > |
13
|
|
|
*/ |
14
|
|
|
class EntityStore { |
15
|
|
|
|
16
|
|
|
private $itemStore; |
17
|
|
|
private $propertyStore; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* This constructor is package private. Construction is done via EntityStoreFactory. |
21
|
|
|
* |
22
|
|
|
* @param ItemStore $itemStore |
23
|
|
|
* @param PropertyStore $propertyStore |
24
|
|
|
*/ |
25
|
18 |
|
public function __construct( ItemStore $itemStore, PropertyStore $propertyStore ) { |
26
|
18 |
|
$this->itemStore = $itemStore; |
27
|
18 |
|
$this->propertyStore = $propertyStore; |
28
|
18 |
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param ItemRow $itemRow |
32
|
|
|
* |
33
|
|
|
* @throws EntityStoreException |
34
|
|
|
*/ |
35
|
10 |
|
public function storeItemRow( ItemRow $itemRow ) { |
36
|
10 |
|
$this->itemStore->storeItemRow( $itemRow ); |
37
|
9 |
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param PropertyRow $propertyRow |
41
|
|
|
* |
42
|
|
|
* @throws EntityStoreException |
43
|
|
|
*/ |
44
|
10 |
|
public function storePropertyRow( PropertyRow $propertyRow ) { |
45
|
10 |
|
$this->propertyStore->storePropertyRow( $propertyRow ); |
46
|
9 |
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param string|int $numericItemId |
50
|
|
|
* @return ItemRow|null |
51
|
|
|
* @throws EntityStoreException |
52
|
|
|
*/ |
53
|
3 |
|
public function getItemRowByNumericItemId( $numericItemId ) { |
54
|
3 |
|
return $this->itemStore->getItemRowByNumericItemId( $numericItemId ); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @param string|int $numericPropertyId |
59
|
|
|
* |
60
|
|
|
* @return PropertyRow|null |
61
|
|
|
* @throws EntityStoreException |
62
|
|
|
*/ |
63
|
3 |
|
public function getPropertyRowByNumericPropertyId( $numericPropertyId ) { |
64
|
3 |
|
return $this->propertyStore->getPropertyRowByNumericPropertyId( $numericPropertyId ); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param int $limit |
69
|
|
|
* @param int $offset |
70
|
|
|
* |
71
|
|
|
* @return PropertyInfo[] |
72
|
|
|
* @throws EntityStoreException |
73
|
|
|
*/ |
74
|
5 |
|
public function getPropertyInfo( $limit, $offset ) { |
75
|
5 |
|
return $this->propertyStore->getPropertyInfo( $limit, $offset ); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param int $limit |
80
|
|
|
* @param int $offset |
81
|
|
|
* |
82
|
|
|
* @return ItemInfo[] |
83
|
|
|
* @throws EntityStoreException |
84
|
|
|
*/ |
85
|
5 |
|
public function getItemInfo( $limit, $offset ) { |
86
|
5 |
|
return $this->itemStore->getItemInfo( $limit, $offset ); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
} |