1 | <?php |
||
18 | abstract class Repository implements RepositoryInterface { |
||
19 | |||
20 | use EntityManagerConsumerTrait; |
||
21 | |||
22 | /** |
||
23 | * The repository of entities. |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $repository; |
||
28 | |||
29 | /** |
||
30 | * The entity type for this repository. |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $entityType; |
||
35 | |||
36 | /** |
||
37 | * The sports db client. |
||
38 | * |
||
39 | * @var \TheSportsDb\Http\TheSportsDbClientInterface |
||
40 | */ |
||
41 | protected $sportsDbClient; |
||
42 | |||
43 | public function __construct(TheSportsDbClientInterface $sportsDbClient, EntityManagerInterface $entityManager = NULL) { |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | 1 | public function byId($id) { |
|
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 1 | public function clear($id) { |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 1 | public function getEntityTypeName() { |
|
78 | |||
79 | /** |
||
80 | * Gets the entity from cache or loads it & updates it with given data. |
||
81 | * |
||
82 | * @param \stdClass $data |
||
83 | * The data of the entity. |
||
84 | * |
||
85 | * @return \TheSportsDb\Entity\EntityInterface |
||
86 | * The matched entity. |
||
87 | */ |
||
88 | 24 | protected function normalizeEntity(\stdClass $data) { |
|
99 | |||
100 | /** |
||
101 | * Gets an array of entities based on given data. |
||
102 | * |
||
103 | * @see \TheSportsDb\Entity\Repository\Repository::normilizeEntity() |
||
104 | * |
||
105 | * @param \stdClass[]|null $data |
||
106 | * The data of the entity. |
||
107 | * |
||
108 | * @return \TheSportsDb\Entity\EntityInterface[] |
||
109 | * The matched entities. |
||
110 | */ |
||
111 | 24 | protected function normalizeArray($data) { |
|
121 | } |
||
122 |