1 | <?php |
||
17 | class RelationFactory implements RelationFactoryInterface |
||
18 | { |
||
19 | const RELATION_FACTORY = 'Ajir\RabbitMqSqlBundle\Model\RelationInterface'; |
||
20 | |||
21 | /** |
||
22 | * @var ReflectionClass |
||
23 | */ |
||
24 | protected $oneToOneClass; |
||
25 | |||
26 | /** |
||
27 | * @var ReflectionClass |
||
28 | */ |
||
29 | protected $oneToManyClass; |
||
30 | |||
31 | /** |
||
32 | * @var ReflectionClass |
||
33 | */ |
||
34 | protected $manyToOneClass; |
||
35 | |||
36 | /** |
||
37 | * @var ReflectionClass |
||
38 | */ |
||
39 | protected $manyToManyClass; |
||
40 | |||
41 | /** |
||
42 | * @param string $oneToOneClassName |
||
43 | * @param string $oneToManyClassName |
||
44 | * @param string $manyToOneClassName |
||
45 | * @param string $manyToManyClassName |
||
46 | */ |
||
47 | 8 | public function __construct( |
|
58 | |||
59 | /** |
||
60 | * @param string $relationClassName |
||
61 | * |
||
62 | * @return ReflectionClass |
||
63 | */ |
||
64 | 8 | private function createRelation($relationClassName) |
|
73 | |||
74 | /** |
||
75 | * @param string $relation |
||
76 | * @param array $data |
||
77 | * |
||
78 | * @return ManyToManyRelation|ManyToOneRelation|OneToManyRelation|OneToOneRelation |
||
79 | * |
||
80 | * @throws InvalidArgumentException |
||
81 | */ |
||
82 | 6 | public function create($relation, $data) |
|
101 | |||
102 | /** |
||
103 | * @param array $data |
||
104 | * |
||
105 | * @return OneToOneRelation |
||
106 | */ |
||
107 | 2 | protected function createOneToOne($data) |
|
111 | |||
112 | /** |
||
113 | * @param array $data |
||
114 | * |
||
115 | * @return OneToManyRelation |
||
116 | */ |
||
117 | 2 | protected function createOneToMany($data) |
|
121 | |||
122 | /** |
||
123 | * @param array $data |
||
124 | * |
||
125 | * @return ManyToOneRelation |
||
126 | */ |
||
127 | 2 | protected function createManyToOne($data) |
|
131 | |||
132 | /** |
||
133 | * @param array $data |
||
134 | * |
||
135 | * @return ManyToManyRelation |
||
136 | */ |
||
137 | 2 | protected function createManyToMany($data) |
|
141 | } |
||
142 |