@@ -124,6 +124,9 @@ discard block |
||
124 | 124 | $this->assertEquals(503, $this->countQuery($em)); |
125 | 125 | } |
126 | 126 | |
127 | + /** |
|
128 | + * @param string $label |
|
129 | + */ |
|
127 | 130 | private function queryEntity(EntityManagerInterface $em, $label) |
128 | 131 | { |
129 | 132 | $times = 100; |
@@ -155,6 +158,9 @@ discard block |
||
155 | 158 | printf("\n%s\n", str_repeat('-', 50)); |
156 | 159 | } |
157 | 160 | |
161 | + /** |
|
162 | + * @param string $label |
|
163 | + */ |
|
158 | 164 | public function findEntityOneToMany(EntityManagerInterface $em, $label) |
159 | 165 | { |
160 | 166 | $times = 50; |
@@ -214,6 +220,9 @@ discard block |
||
214 | 220 | printf("\n%s\n", str_repeat('-', 50)); |
215 | 221 | } |
216 | 222 | |
223 | + /** |
|
224 | + * @param string $label |
|
225 | + */ |
|
217 | 226 | private function findEntity(EntityManagerInterface $em, $label) |
218 | 227 | { |
219 | 228 | $times = 10; |
@@ -249,6 +258,9 @@ discard block |
||
249 | 258 | printf("\n%s\n", str_repeat('-', 50)); |
250 | 259 | } |
251 | 260 | |
261 | + /** |
|
262 | + * @param string $label |
|
263 | + */ |
|
252 | 264 | private function findAllEntity(EntityManagerInterface $em, $label) |
253 | 265 | { |
254 | 266 | $times = 100; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $size = 500; |
131 | 131 | $startPersist = microtime(true); |
132 | 132 | |
133 | - echo PHP_EOL . $label; |
|
133 | + echo PHP_EOL.$label; |
|
134 | 134 | |
135 | 135 | for ($i = 0; $i < $size; $i++) { |
136 | 136 | $em->persist(new Country("Country $i")); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $startPersist = microtime(true); |
165 | 165 | $country = new Country("Country"); |
166 | 166 | |
167 | - echo PHP_EOL . $label; |
|
167 | + echo PHP_EOL.$label; |
|
168 | 168 | |
169 | 169 | $em->persist($country); |
170 | 170 | $em->flush(); |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | $em->flush(); |
195 | 195 | $em->clear(); |
196 | 196 | |
197 | - printf("\n[%s] persist %s states and %s cities", number_format( microtime(true) - $startPersist, 6), count($states), count($cities)); |
|
197 | + printf("\n[%s] persist %s states and %s cities", number_format(microtime(true) - $startPersist, 6), count($states), count($cities)); |
|
198 | 198 | |
199 | - $startFind = microtime(true); |
|
199 | + $startFind = microtime(true); |
|
200 | 200 | |
201 | 201 | for ($i = 0; $i < $times; $i++) { |
202 | 202 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $countries = []; |
222 | 222 | $startPersist = microtime(true); |
223 | 223 | |
224 | - echo PHP_EOL . $label; |
|
224 | + echo PHP_EOL.$label; |
|
225 | 225 | |
226 | 226 | for ($i = 0; $i < $size; $i++) { |
227 | 227 | $country = new Country("Country $i"); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | printf("\n[%s] persist %s countries", number_format(microtime(true) - $startPersist, 6), $size); |
238 | 238 | |
239 | - $startFind = microtime(true); |
|
239 | + $startFind = microtime(true); |
|
240 | 240 | |
241 | 241 | for ($i = 0; $i <= $times; $i++) { |
242 | 242 | foreach ($countries as $country) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $startPersist = microtime(true); |
257 | 257 | $rep = $em->getRepository(Country::class); |
258 | 258 | |
259 | - echo PHP_EOL . $label; |
|
259 | + echo PHP_EOL.$label; |
|
260 | 260 | |
261 | 261 | for ($i = 0; $i < $size; $i++) { |
262 | 262 | $em->persist(new Country("Country $i")); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | |
268 | 268 | printf("\n[%s] persist %s countries", number_format(microtime(true) - $startPersist, 6), $size); |
269 | 269 | |
270 | - $startFind = microtime(true); |
|
270 | + $startFind = microtime(true); |
|
271 | 271 | |
272 | 272 | for ($i = 0; $i <= $times; $i++) { |
273 | 273 | $list = $rep->findAll(); |
@@ -43,6 +43,10 @@ |
||
43 | 43 | $this->_em = $this->_getTestEntityManager(); |
44 | 44 | } |
45 | 45 | |
46 | + /** |
|
47 | + * @param string $dqlToBeTested |
|
48 | + * @param string $sqlToBeConfirmed |
|
49 | + */ |
|
46 | 50 | public function assertSqlGeneration($dqlToBeTested, $sqlToBeConfirmed) |
47 | 51 | { |
48 | 52 | try { |
@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | $this->_em = $this->_getTestEntityManager(); |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $dql |
|
22 | + */ |
|
20 | 23 | public function assertValidDQL($dql, $debug = false) |
21 | 24 | { |
22 | 25 | try { |
@@ -30,6 +33,9 @@ discard block |
||
30 | 33 | } |
31 | 34 | } |
32 | 35 | |
36 | + /** |
|
37 | + * @param string $dql |
|
38 | + */ |
|
33 | 39 | public function assertInvalidDQL($dql, $debug = false) |
34 | 40 | { |
35 | 41 | try { |
@@ -3,8 +3,8 @@ |
||
3 | 3 | namespace Doctrine\Tests\ORM\Query; |
4 | 4 | |
5 | 5 | use Doctrine\ORM\EntityManagerInterface; |
6 | -use Doctrine\ORM\Query, |
|
7 | - Doctrine\ORM\Query\QueryException; |
|
6 | +use Doctrine\ORM\Query; |
|
7 | +use Doctrine\ORM\Query\QueryException; |
|
8 | 8 | use Doctrine\Tests\Mocks\MockTreeWalker; |
9 | 9 | use Doctrine\Tests\OrmTestCase; |
10 | 10 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $query->setDQL($dql); |
57 | 57 | |
58 | 58 | foreach ($hints as $key => $value) { |
59 | - $query->setHint($key, $value); |
|
59 | + $query->setHint($key, $value); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $parser = new Query\Parser($query); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $this->addToAssertionCount(1); |
28 | 28 | } catch (QueryException $e) { |
29 | 29 | if ($debug) { |
30 | - echo $e->getTraceAsString() . PHP_EOL; |
|
30 | + echo $e->getTraceAsString().PHP_EOL; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $this->fail($e->getMessage()); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $this->fail('No syntax errors were detected, when syntax errors were expected'); |
43 | 43 | } catch (QueryException $e) { |
44 | 44 | if ($debug) { |
45 | - echo $e->getMessage() . PHP_EOL; |
|
46 | - echo $e->getTraceAsString() . PHP_EOL; |
|
45 | + echo $e->getMessage().PHP_EOL; |
|
46 | + echo $e->getTraceAsString().PHP_EOL; |
|
47 | 47 | } |
48 | 48 | $this->addToAssertionCount(1); |
49 | 49 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ['SELECT foo: FROM Doctrine\Tests\Models\CMS\CmsUser foo:'], |
113 | 113 | |
114 | 114 | /* Checks for invalid AbstractSchemaName */ |
115 | - ['SELECT u FROM UnknownClass u'], // unknown |
|
115 | + ['SELECT u FROM UnknownClass u'], // unknown |
|
116 | 116 | ['SELECT u FROM Unknown\Class u'], // unknown with namespace |
117 | 117 | ['SELECT u FROM \Unknown\Class u'], // unknown, leading backslash |
118 | 118 | ['SELECT u FROM Unknown\\\\Class u'], // unknown, syntactically bogus (duplicate \\) |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | */ |
586 | 586 | public function testDQLKeywordInJoinIsAllowed() |
587 | 587 | { |
588 | - $this->assertValidDQL('SELECT u FROM ' . __NAMESPACE__ . '\DQLKeywordsModelUser u JOIN u.group g'); |
|
588 | + $this->assertValidDQL('SELECT u FROM '.__NAMESPACE__.'\DQLKeywordsModelUser u JOIN u.group g'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | */ |
594 | 594 | public function testDQLKeywordInConditionIsAllowed() |
595 | 595 | { |
596 | - $this->assertValidDQL('SELECT g FROM ' . __NAMESPACE__ . '\DQLKeywordsModelGroup g WHERE g.from=0'); |
|
596 | + $this->assertValidDQL('SELECT g FROM '.__NAMESPACE__.'\DQLKeywordsModelGroup g WHERE g.from=0'); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /* The exception is currently thrown in the SQLWalker, not earlier. |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | public function testNewLiteralExpression() |
700 | 700 | { |
701 | - $this->assertValidDQL("SELECT new " . __NAMESPACE__ . "\\DummyStruct(u.id, 'foo', 1, true) FROM Doctrine\Tests\Models\CMS\CmsUser u"); |
|
701 | + $this->assertValidDQL("SELECT new ".__NAMESPACE__."\\DummyStruct(u.id, 'foo', 1, true) FROM Doctrine\Tests\Models\CMS\CmsUser u"); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | /** |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | */ |
707 | 707 | public function testNewLiteralWithSubselectExpression() |
708 | 708 | { |
709 | - $this->assertValidDQL("SELECT new " . __NAMESPACE__ . "\\DummyStruct(u.id, 'foo', (SELECT 1 FROM Doctrine\Tests\Models\CMS\CmsUser su), true) FROM Doctrine\Tests\Models\CMS\CmsUser u"); |
|
709 | + $this->assertValidDQL("SELECT new ".__NAMESPACE__."\\DummyStruct(u.id, 'foo', (SELECT 1 FROM Doctrine\Tests\Models\CMS\CmsUser su), true) FROM Doctrine\Tests\Models\CMS\CmsUser u"); |
|
710 | 710 | } |
711 | 711 | } |
712 | 712 |
@@ -373,6 +373,9 @@ discard block |
||
373 | 373 | return $this->items; |
374 | 374 | } |
375 | 375 | |
376 | + /** |
|
377 | + * @param string $value |
|
378 | + */ |
|
376 | 379 | public function setTransient($value) { |
377 | 380 | if ($value != $this->transient) { |
378 | 381 | $this->_onPropertyChanged('transient', $this->transient, $value); |
@@ -384,6 +387,9 @@ discard block |
||
384 | 387 | return $this->data; |
385 | 388 | } |
386 | 389 | |
390 | + /** |
|
391 | + * @param string $data |
|
392 | + */ |
|
387 | 393 | public function setData($data) { |
388 | 394 | if ($data != $this->data) { |
389 | 395 | $this->_onPropertyChanged('data', $this->data, $data); |
@@ -396,6 +402,9 @@ discard block |
||
396 | 402 | $this->_listeners[] = $listener; |
397 | 403 | } |
398 | 404 | |
405 | + /** |
|
406 | + * @param string $propName |
|
407 | + */ |
|
399 | 408 | protected function _onPropertyChanged($propName, $oldValue, $newValue) { |
400 | 409 | if ($this->_listeners) { |
401 | 410 | foreach ($this->_listeners as $listener) { |
@@ -426,6 +435,9 @@ discard block |
||
426 | 435 | return $this->owner; |
427 | 436 | } |
428 | 437 | |
438 | + /** |
|
439 | + * @param NotifyChangedEntity|null $owner |
|
440 | + */ |
|
429 | 441 | public function setOwner($owner) { |
430 | 442 | $this->owner = $owner; |
431 | 443 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | 'empty string, single field' => [$emptyString, ''], |
426 | 426 | 'non-empty string, single field' => [$nonEmptyString, $nonEmptyString->id], |
427 | 427 | 'empty strings, two fields' => [$emptyStrings, ' '], |
428 | - 'non-empty strings, two fields' => [$nonEmptyStrings, $nonEmptyStrings->id1 . ' ' . $nonEmptyStrings->id2], |
|
428 | + 'non-empty strings, two fields' => [$nonEmptyStrings, $nonEmptyStrings->id1.' '.$nonEmptyStrings->id2], |
|
429 | 429 | 'boolean true' => [$booleanTrue, '1'], |
430 | 430 | 'boolean false' => [$booleanFalse, ''], |
431 | 431 | ]; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | |
457 | 457 | public function entitiesWithInvalidIdentifiersProvider() |
458 | 458 | { |
459 | - $firstNullString = new EntityWithCompositeStringIdentifier(); |
|
459 | + $firstNullString = new EntityWithCompositeStringIdentifier(); |
|
460 | 460 | |
461 | 461 | $firstNullString->id2 = uniqid('id2', true); |
462 | 462 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ->eventManager |
516 | 516 | ->expects(self::any()) |
517 | 517 | ->method('hasListeners') |
518 | - ->willReturnCallback(function ($eventName) { |
|
518 | + ->willReturnCallback(function($eventName) { |
|
519 | 519 | return $eventName === Events::prePersist; |
520 | 520 | }); |
521 | 521 | $this |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | ->method('dispatchEvent') |
525 | 525 | ->with( |
526 | 526 | self::anything(), |
527 | - self::callback(function (LifecycleEventArgs $args) use ($entity, $generatedFieldValue) { |
|
527 | + self::callback(function(LifecycleEventArgs $args) use ($entity, $generatedFieldValue) { |
|
528 | 528 | /* @var $object EntityWithRandomlyGeneratedField */ |
529 | 529 | $object = $args->getObject(); |
530 | 530 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | ->eventManager |
565 | 565 | ->expects(self::any()) |
566 | 566 | ->method('hasListeners') |
567 | - ->willReturnCallback(function ($eventName) { |
|
567 | + ->willReturnCallback(function($eventName) { |
|
568 | 568 | return $eventName === Events::prePersist; |
569 | 569 | }); |
570 | 570 | $this->eventManager->expects(self::never())->method('dispatchEvent'); |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected $secondLevelCacheDriverImpl = null; |
53 | 53 | |
54 | 54 | /** |
55 | - * @param array $paths |
|
55 | + * @param string[] $paths |
|
56 | 56 | * @param mixed $alias |
57 | 57 | * |
58 | 58 | * @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - Annotations\AnnotationRegistry::registerFile(__DIR__ . "/../../../lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); |
|
99 | + Annotations\AnnotationRegistry::registerFile(__DIR__."/../../../lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); |
|
100 | 100 | |
101 | 101 | return new AnnotationDriver($reader, (array) $paths); |
102 | 102 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | $config->setMetadataCacheImpl($metadataCache); |
128 | 128 | $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver([], true)); |
129 | 129 | $config->setQueryCacheImpl(self::getSharedQueryCacheImpl()); |
130 | - $config->setProxyDir(__DIR__ . '/Proxies'); |
|
130 | + $config->setProxyDir(__DIR__.'/Proxies'); |
|
131 | 131 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
132 | 132 | $config->setMetadataDriverImpl($config->newDefaultAnnotationDriver( |
133 | 133 | [ |
134 | - realpath(__DIR__ . '/Models/Cache') |
|
134 | + realpath(__DIR__.'/Models/Cache') |
|
135 | 135 | ], true)); |
136 | 136 | |
137 | 137 | if ($this->isSecondLevelCacheEnabled) { |
@@ -83,6 +83,7 @@ |
||
83 | 83 | |
84 | 84 | /** |
85 | 85 | * {@inheritDoc} |
86 | + * @param string $value |
|
86 | 87 | */ |
87 | 88 | public function setValue($object, $value = null) |
88 | 89 | { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | /** |
184 | 184 | * |
185 | - * @param kateglo\application\models\Type $type |
|
185 | + * @param Type $type |
|
186 | 186 | * @return void |
187 | 187 | */ |
188 | 188 | public function addType(Type $type){ |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | |
195 | 195 | /** |
196 | 196 | * |
197 | - * @param kateglo\application\models\Type $type |
|
197 | + * @param Type $type |
|
198 | 198 | * @return void |
199 | 199 | */ |
200 | 200 | public function removeType(Type $type) |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | /** |
306 | 306 | * |
307 | - * @param kateglo\application\models\Lemma $lemma |
|
307 | + * @param Lemma $lemma |
|
308 | 308 | * @return void |
309 | 309 | */ |
310 | 310 | public function addLemma(Lemma $lemma) |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | /** |
319 | 319 | * |
320 | - * @param kateglo\application\models\Lemma $lemma |
|
320 | + * @param Lemma $lemma |
|
321 | 321 | * @return void |
322 | 322 | */ |
323 | 323 | public function removeLEmma(Lemma $lemma) |
@@ -131,65 +131,65 @@ discard block |
||
131 | 131 | */ |
132 | 132 | class Lemma { |
133 | 133 | |
134 | - const CLASS_NAME = __CLASS__; |
|
135 | - |
|
136 | - /** |
|
137 | - * @var int |
|
138 | - * @Id |
|
139 | - * @Column(type="integer", name="lemma_id") |
|
140 | - * @GeneratedValue(strategy="AUTO") |
|
141 | - */ |
|
142 | - private $id; |
|
143 | - |
|
144 | - /** |
|
145 | - * |
|
146 | - * @var string |
|
147 | - * @Column(type="string", name="lemma_name", unique=true, length=255) |
|
148 | - */ |
|
149 | - private $lemma; |
|
150 | - |
|
151 | - /** |
|
152 | - * @var kateglo\application\utilities\collections\ArrayCollection |
|
153 | - * @ManyToMany(targetEntity="Type", mappedBy="lemmas", cascade={"persist"}) |
|
154 | - */ |
|
155 | - private $types; |
|
156 | - |
|
157 | - public function __construct() { |
|
158 | - $this->types = new ArrayCollection(); |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * |
|
164 | - * @return int |
|
165 | - */ |
|
166 | - public function getId(){ |
|
167 | - return $this->id; |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * |
|
172 | - * @param string $lemma |
|
173 | - * @return void |
|
174 | - */ |
|
175 | - public function setLemma($lemma){ |
|
176 | - $this->lemma = $lemma; |
|
177 | - } |
|
178 | - |
|
179 | - /** |
|
180 | - * |
|
181 | - * @return string |
|
182 | - */ |
|
183 | - public function getLemma(){ |
|
184 | - return $this->lemma; |
|
185 | - } |
|
186 | - |
|
187 | - /** |
|
134 | + const CLASS_NAME = __CLASS__; |
|
135 | + |
|
136 | + /** |
|
137 | + * @var int |
|
138 | + * @Id |
|
139 | + * @Column(type="integer", name="lemma_id") |
|
140 | + * @GeneratedValue(strategy="AUTO") |
|
141 | + */ |
|
142 | + private $id; |
|
143 | + |
|
144 | + /** |
|
145 | + * |
|
146 | + * @var string |
|
147 | + * @Column(type="string", name="lemma_name", unique=true, length=255) |
|
148 | + */ |
|
149 | + private $lemma; |
|
150 | + |
|
151 | + /** |
|
152 | + * @var kateglo\application\utilities\collections\ArrayCollection |
|
153 | + * @ManyToMany(targetEntity="Type", mappedBy="lemmas", cascade={"persist"}) |
|
154 | + */ |
|
155 | + private $types; |
|
156 | + |
|
157 | + public function __construct() { |
|
158 | + $this->types = new ArrayCollection(); |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * |
|
164 | + * @return int |
|
165 | + */ |
|
166 | + public function getId(){ |
|
167 | + return $this->id; |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * |
|
172 | + * @param string $lemma |
|
173 | + * @return void |
|
174 | + */ |
|
175 | + public function setLemma($lemma){ |
|
176 | + $this->lemma = $lemma; |
|
177 | + } |
|
178 | + |
|
179 | + /** |
|
180 | + * |
|
181 | + * @return string |
|
182 | + */ |
|
183 | + public function getLemma(){ |
|
184 | + return $this->lemma; |
|
185 | + } |
|
186 | + |
|
187 | + /** |
|
188 | 188 | * |
189 | 189 | * @param kateglo\application\models\Type $type |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - public function addType(Type $type){ |
|
192 | + public function addType(Type $type){ |
|
193 | 193 | if (!$this->types->contains($type)) { |
194 | 194 | $this->types[] = $type; |
195 | 195 | $type->addLemma($this); |
@@ -225,121 +225,121 @@ discard block |
||
225 | 225 | */ |
226 | 226 | class Type { |
227 | 227 | |
228 | - const CLASS_NAME = __CLASS__; |
|
229 | - |
|
230 | - /** |
|
231 | - * |
|
232 | - * @var int |
|
233 | - * @Id |
|
234 | - * @Column(type="integer", name="type_id") |
|
235 | - * @GeneratedValue(strategy="AUTO") |
|
236 | - */ |
|
237 | - private $id; |
|
238 | - |
|
239 | - /** |
|
240 | - * |
|
241 | - * @var string |
|
242 | - * @Column(type="string", name="type_name", unique=true) |
|
243 | - */ |
|
244 | - private $type; |
|
245 | - |
|
246 | - /** |
|
247 | - * |
|
248 | - * @var string |
|
249 | - * @Column(type="string", name="type_abbreviation", unique=true) |
|
250 | - */ |
|
251 | - private $abbreviation; |
|
252 | - |
|
253 | - /** |
|
254 | - * @var kateglo\application\helpers\collections\ArrayCollection |
|
255 | - * @ManyToMany(targetEntity="Lemma") |
|
256 | - * @JoinTable(name="lemma_type", |
|
257 | - * joinColumns={@JoinColumn(name="type_id", referencedColumnName="type_id")}, |
|
258 | - * inverseJoinColumns={@JoinColumn(name="lemma_id", referencedColumnName="lemma_id")} |
|
259 | - * ) |
|
260 | - */ |
|
261 | - private $lemmas; |
|
262 | - |
|
263 | - public function __construct(){ |
|
264 | - $this->lemmas = new ArrayCollection(); |
|
265 | - } |
|
266 | - |
|
267 | - /** |
|
268 | - * |
|
269 | - * @return int |
|
270 | - */ |
|
271 | - public function getId(){ |
|
272 | - return $this->id; |
|
273 | - } |
|
274 | - |
|
275 | - /** |
|
276 | - * |
|
277 | - * @param string $type |
|
278 | - * @return void |
|
279 | - */ |
|
280 | - public function setType($type){ |
|
281 | - $this->type = $type; |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * |
|
286 | - * @return string |
|
287 | - */ |
|
288 | - public function getType(){ |
|
289 | - return $this->type; |
|
290 | - } |
|
291 | - |
|
292 | - /** |
|
293 | - * |
|
294 | - * @param string $abbreviation |
|
295 | - * @return void |
|
296 | - */ |
|
297 | - public function setAbbreviation($abbreviation){ |
|
298 | - $this->abbreviation = $abbreviation; |
|
299 | - } |
|
300 | - |
|
301 | - /** |
|
302 | - * |
|
303 | - * @return string |
|
304 | - */ |
|
305 | - public function getAbbreviation(){ |
|
306 | - return $this->abbreviation; |
|
307 | - } |
|
308 | - |
|
309 | - /** |
|
310 | - * |
|
311 | - * @param kateglo\application\models\Lemma $lemma |
|
312 | - * @return void |
|
313 | - */ |
|
314 | - public function addLemma(Lemma $lemma) |
|
315 | - { |
|
316 | - if (!$this->lemmas->contains($lemma)) { |
|
317 | - $this->lemmas[] = $lemma; |
|
318 | - $lemma->addType($this); |
|
319 | - } |
|
320 | - } |
|
321 | - |
|
322 | - /** |
|
323 | - * |
|
324 | - * @param kateglo\application\models\Lemma $lemma |
|
325 | - * @return void |
|
326 | - */ |
|
327 | - public function removeLEmma(Lemma $lemma) |
|
328 | - { |
|
329 | - $removed = $this->lemmas->removeElement($lemma); |
|
330 | - if ($removed !== null) { |
|
331 | - $removed->removeType($this); |
|
332 | - } |
|
333 | - } |
|
334 | - |
|
335 | - /** |
|
336 | - * |
|
337 | - * @return kateglo\application\helpers\collections\ArrayCollection |
|
338 | - */ |
|
339 | - public function getCategories() |
|
340 | - { |
|
341 | - return $this->categories; |
|
342 | - } |
|
228 | + const CLASS_NAME = __CLASS__; |
|
229 | + |
|
230 | + /** |
|
231 | + * |
|
232 | + * @var int |
|
233 | + * @Id |
|
234 | + * @Column(type="integer", name="type_id") |
|
235 | + * @GeneratedValue(strategy="AUTO") |
|
236 | + */ |
|
237 | + private $id; |
|
238 | + |
|
239 | + /** |
|
240 | + * |
|
241 | + * @var string |
|
242 | + * @Column(type="string", name="type_name", unique=true) |
|
243 | + */ |
|
244 | + private $type; |
|
245 | + |
|
246 | + /** |
|
247 | + * |
|
248 | + * @var string |
|
249 | + * @Column(type="string", name="type_abbreviation", unique=true) |
|
250 | + */ |
|
251 | + private $abbreviation; |
|
252 | + |
|
253 | + /** |
|
254 | + * @var kateglo\application\helpers\collections\ArrayCollection |
|
255 | + * @ManyToMany(targetEntity="Lemma") |
|
256 | + * @JoinTable(name="lemma_type", |
|
257 | + * joinColumns={@JoinColumn(name="type_id", referencedColumnName="type_id")}, |
|
258 | + * inverseJoinColumns={@JoinColumn(name="lemma_id", referencedColumnName="lemma_id")} |
|
259 | + * ) |
|
260 | + */ |
|
261 | + private $lemmas; |
|
262 | + |
|
263 | + public function __construct(){ |
|
264 | + $this->lemmas = new ArrayCollection(); |
|
265 | + } |
|
266 | + |
|
267 | + /** |
|
268 | + * |
|
269 | + * @return int |
|
270 | + */ |
|
271 | + public function getId(){ |
|
272 | + return $this->id; |
|
273 | + } |
|
274 | + |
|
275 | + /** |
|
276 | + * |
|
277 | + * @param string $type |
|
278 | + * @return void |
|
279 | + */ |
|
280 | + public function setType($type){ |
|
281 | + $this->type = $type; |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * |
|
286 | + * @return string |
|
287 | + */ |
|
288 | + public function getType(){ |
|
289 | + return $this->type; |
|
290 | + } |
|
291 | + |
|
292 | + /** |
|
293 | + * |
|
294 | + * @param string $abbreviation |
|
295 | + * @return void |
|
296 | + */ |
|
297 | + public function setAbbreviation($abbreviation){ |
|
298 | + $this->abbreviation = $abbreviation; |
|
299 | + } |
|
300 | + |
|
301 | + /** |
|
302 | + * |
|
303 | + * @return string |
|
304 | + */ |
|
305 | + public function getAbbreviation(){ |
|
306 | + return $this->abbreviation; |
|
307 | + } |
|
308 | + |
|
309 | + /** |
|
310 | + * |
|
311 | + * @param kateglo\application\models\Lemma $lemma |
|
312 | + * @return void |
|
313 | + */ |
|
314 | + public function addLemma(Lemma $lemma) |
|
315 | + { |
|
316 | + if (!$this->lemmas->contains($lemma)) { |
|
317 | + $this->lemmas[] = $lemma; |
|
318 | + $lemma->addType($this); |
|
319 | + } |
|
320 | + } |
|
321 | + |
|
322 | + /** |
|
323 | + * |
|
324 | + * @param kateglo\application\models\Lemma $lemma |
|
325 | + * @return void |
|
326 | + */ |
|
327 | + public function removeLEmma(Lemma $lemma) |
|
328 | + { |
|
329 | + $removed = $this->lemmas->removeElement($lemma); |
|
330 | + if ($removed !== null) { |
|
331 | + $removed->removeType($this); |
|
332 | + } |
|
333 | + } |
|
334 | + |
|
335 | + /** |
|
336 | + * |
|
337 | + * @return kateglo\application\helpers\collections\ArrayCollection |
|
338 | + */ |
|
339 | + public function getCategories() |
|
340 | + { |
|
341 | + return $this->categories; |
|
342 | + } |
|
343 | 343 | |
344 | 344 | } |
345 | 345 |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * |
164 | 164 | * @return int |
165 | 165 | */ |
166 | - public function getId(){ |
|
166 | + public function getId() { |
|
167 | 167 | return $this->id; |
168 | 168 | } |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @param string $lemma |
173 | 173 | * @return void |
174 | 174 | */ |
175 | - public function setLemma($lemma){ |
|
175 | + public function setLemma($lemma) { |
|
176 | 176 | $this->lemma = $lemma; |
177 | 177 | } |
178 | 178 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public function getLemma(){ |
|
183 | + public function getLemma() { |
|
184 | 184 | return $this->lemma; |
185 | 185 | } |
186 | 186 | |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | * @param kateglo\application\models\Type $type |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - public function addType(Type $type){ |
|
193 | - if (!$this->types->contains($type)) { |
|
192 | + public function addType(Type $type) { |
|
193 | + if ( ! $this->types->contains($type)) { |
|
194 | 194 | $this->types[] = $type; |
195 | 195 | $type->addLemma($this); |
196 | 196 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | private $lemmas; |
262 | 262 | |
263 | - public function __construct(){ |
|
263 | + public function __construct() { |
|
264 | 264 | $this->lemmas = new ArrayCollection(); |
265 | 265 | } |
266 | 266 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return int |
270 | 270 | */ |
271 | - public function getId(){ |
|
271 | + public function getId() { |
|
272 | 272 | return $this->id; |
273 | 273 | } |
274 | 274 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param string $type |
278 | 278 | * @return void |
279 | 279 | */ |
280 | - public function setType($type){ |
|
280 | + public function setType($type) { |
|
281 | 281 | $this->type = $type; |
282 | 282 | } |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @return string |
287 | 287 | */ |
288 | - public function getType(){ |
|
288 | + public function getType() { |
|
289 | 289 | return $this->type; |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param string $abbreviation |
295 | 295 | * @return void |
296 | 296 | */ |
297 | - public function setAbbreviation($abbreviation){ |
|
297 | + public function setAbbreviation($abbreviation) { |
|
298 | 298 | $this->abbreviation = $abbreviation; |
299 | 299 | } |
300 | 300 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return string |
304 | 304 | */ |
305 | - public function getAbbreviation(){ |
|
305 | + public function getAbbreviation() { |
|
306 | 306 | return $this->abbreviation; |
307 | 307 | } |
308 | 308 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function addLemma(Lemma $lemma) |
315 | 315 | { |
316 | - if (!$this->lemmas->contains($lemma)) { |
|
316 | + if ( ! $this->lemmas->contains($lemma)) { |
|
317 | 317 | $this->lemmas[] = $lemma; |
318 | 318 | $lemma->addType($this); |
319 | 319 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | * @param Definition $definition |
385 | 385 | * @return void |
386 | 386 | */ |
387 | - public function addDefinition(Definition $definition){ |
|
387 | + public function addDefinition(Definition $definition) { |
|
388 | 388 | $this->definitions[] = $definition; |
389 | 389 | $definition->setPhrase($this); |
390 | 390 | } |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * @return int |
394 | 394 | */ |
395 | - public function getId(){ |
|
395 | + public function getId() { |
|
396 | 396 | return $this->id; |
397 | 397 | } |
398 | 398 | |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | * @param string $phrase |
401 | 401 | * @return void |
402 | 402 | */ |
403 | - public function setPhrase($phrase){ |
|
403 | + public function setPhrase($phrase) { |
|
404 | 404 | $this->phrase = $phrase; |
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
408 | 408 | * @return string |
409 | 409 | */ |
410 | - public function getPhrase(){ |
|
410 | + public function getPhrase() { |
|
411 | 411 | return $this->phrase; |
412 | 412 | } |
413 | 413 | |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @param PhraseType $type |
417 | 417 | * @return void |
418 | 418 | */ |
419 | - public function setType(PhraseType $type){ |
|
419 | + public function setType(PhraseType $type) { |
|
420 | 420 | $this->type = $type; |
421 | 421 | } |
422 | 422 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @return PhraseType |
426 | 426 | */ |
427 | - public function getType(){ |
|
427 | + public function getType() { |
|
428 | 428 | return $this->type; |
429 | 429 | } |
430 | 430 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | * |
433 | 433 | * @return ArrayCollection |
434 | 434 | */ |
435 | - public function getDefinitions(){ |
|
435 | + public function getDefinitions() { |
|
436 | 436 | return $this->definitions; |
437 | 437 | } |
438 | 438 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | /** |
475 | 475 | * @return int |
476 | 476 | */ |
477 | - public function getId(){ |
|
477 | + public function getId() { |
|
478 | 478 | return $this->id; |
479 | 479 | } |
480 | 480 | |
@@ -482,14 +482,14 @@ discard block |
||
482 | 482 | * @param string $type |
483 | 483 | * @return void |
484 | 484 | */ |
485 | - public function setType($type){ |
|
485 | + public function setType($type) { |
|
486 | 486 | $this->type = $type; |
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
490 | 490 | * @return string |
491 | 491 | */ |
492 | - public function getType(){ |
|
492 | + public function getType() { |
|
493 | 493 | return $this->type; |
494 | 494 | } |
495 | 495 | |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | * @param string $abbreviation |
498 | 498 | * @return void |
499 | 499 | */ |
500 | - public function setAbbreviation($abbreviation){ |
|
500 | + public function setAbbreviation($abbreviation) { |
|
501 | 501 | $this->abbreviation = $abbreviation; |
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
505 | 505 | * @return string |
506 | 506 | */ |
507 | - public function getAbbreviation(){ |
|
507 | + public function getAbbreviation() { |
|
508 | 508 | return $this->abbreviation; |
509 | 509 | } |
510 | 510 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param ArrayCollection $phrases |
513 | 513 | * @return void |
514 | 514 | */ |
515 | - public function setPhrases($phrases){ |
|
515 | + public function setPhrases($phrases) { |
|
516 | 516 | $this->phrases = $phrases; |
517 | 517 | } |
518 | 518 | |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | * |
521 | 521 | * @return ArrayCollection |
522 | 522 | */ |
523 | - public function getPhrases(){ |
|
523 | + public function getPhrases() { |
|
524 | 524 | return $this->phrases; |
525 | 525 | } |
526 | 526 | |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | /** |
556 | 556 | * @return int |
557 | 557 | */ |
558 | - public function getId(){ |
|
558 | + public function getId() { |
|
559 | 559 | return $this->id; |
560 | 560 | } |
561 | 561 | |
@@ -563,14 +563,14 @@ discard block |
||
563 | 563 | * @param Phrase $phrase |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - public function setPhrase(Phrase $phrase){ |
|
566 | + public function setPhrase(Phrase $phrase) { |
|
567 | 567 | $this->phrase = $phrase; |
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
571 | 571 | * @return Phrase |
572 | 572 | */ |
573 | - public function getPhrase(){ |
|
573 | + public function getPhrase() { |
|
574 | 574 | return $this->phrase; |
575 | 575 | } |
576 | 576 | |
@@ -587,14 +587,14 @@ discard block |
||
587 | 587 | * @param string $definition |
588 | 588 | * @return void |
589 | 589 | */ |
590 | - public function setDefinition($definition){ |
|
590 | + public function setDefinition($definition) { |
|
591 | 591 | $this->definition = $definition; |
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
595 | 595 | * @return string |
596 | 596 | */ |
597 | - public function getDefinition(){ |
|
597 | + public function getDefinition() { |
|
598 | 598 | return $this->definition; |
599 | 599 | } |
600 | 600 | } |
@@ -45,6 +45,9 @@ |
||
45 | 45 | */ |
46 | 46 | class ConvertDoctrine1SchemaTest extends OrmTestCase |
47 | 47 | { |
48 | + /** |
|
49 | + * @param YamlDriver $metadataDriver |
|
50 | + */ |
|
48 | 51 | protected function _createEntityManager($metadataDriver) |
49 | 52 | { |
50 | 53 | $driverMock = new DriverMock(); |
@@ -25,7 +25,6 @@ |
||
25 | 25 | use Doctrine\ORM\Mapping\Driver\YamlDriver; |
26 | 26 | use Doctrine\ORM\Tools\Export\ClassMetadataExporter; |
27 | 27 | use Doctrine\ORM\Tools\ConvertDoctrine1Schema; |
28 | -use Doctrine\Tests\Mocks\MetadataDriverMock; |
|
29 | 28 | use Doctrine\Tests\Mocks\EntityManagerMock; |
30 | 29 | use Doctrine\Tests\Mocks\ConnectionMock; |
31 | 30 | use Doctrine\Tests\Mocks\DriverMock; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | $driverMock = new DriverMock(); |
32 | 32 | $config = new Configuration(); |
33 | - $config->setProxyDir(__DIR__ . '/../../Proxies'); |
|
33 | + $config->setProxyDir(__DIR__.'/../../Proxies'); |
|
34 | 34 | $config->setProxyNamespace('Doctrine\Tests\Proxies'); |
35 | 35 | $eventManager = new EventManager(); |
36 | 36 | $conn = new ConnectionMock([], $driverMock, $config, $eventManager); |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $cme = new ClassMetadataExporter(); |
49 | - $converter = new ConvertDoctrine1Schema(__DIR__ . '/doctrine1schema'); |
|
49 | + $converter = new ConvertDoctrine1Schema(__DIR__.'/doctrine1schema'); |
|
50 | 50 | |
51 | - $exporter = $cme->getExporter('yml', __DIR__ . '/convert'); |
|
51 | + $exporter = $cme->getExporter('yml', __DIR__.'/convert'); |
|
52 | 52 | $exporter->setOverwriteExistingFiles(true); |
53 | 53 | $exporter->setMetadata($converter->getMetadata()); |
54 | 54 | $exporter->export(); |
55 | 55 | |
56 | - $this->assertTrue(file_exists(__DIR__ . '/convert/User.dcm.yml')); |
|
57 | - $this->assertTrue(file_exists(__DIR__ . '/convert/Profile.dcm.yml')); |
|
56 | + $this->assertTrue(file_exists(__DIR__.'/convert/User.dcm.yml')); |
|
57 | + $this->assertTrue(file_exists(__DIR__.'/convert/Profile.dcm.yml')); |
|
58 | 58 | |
59 | - $metadataDriver = new YamlDriver(__DIR__ . '/convert'); |
|
59 | + $metadataDriver = new YamlDriver(__DIR__.'/convert'); |
|
60 | 60 | $em = $this->_createEntityManager($metadataDriver); |
61 | 61 | $cmf = new DisconnectedClassMetadataFactory(); |
62 | 62 | $cmf->setEntityManager($em); |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | public function tearDown() |
83 | 83 | { |
84 | - @unlink(__DIR__ . '/convert/User.dcm.yml'); |
|
85 | - @unlink(__DIR__ . '/convert/Profile.dcm.yml'); |
|
86 | - @rmdir(__DIR__ . '/convert'); |
|
84 | + @unlink(__DIR__.'/convert/User.dcm.yml'); |
|
85 | + @unlink(__DIR__.'/convert/Profile.dcm.yml'); |
|
86 | + @rmdir(__DIR__.'/convert'); |
|
87 | 87 | } |
88 | 88 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
130 | - * @param field_type $fooTitle |
|
130 | + * @param string $fooTitle |
|
131 | 131 | */ |
132 | 132 | public function setFooTitle($fooTitle) |
133 | 133 | { |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * @param field_type $barTitle |
|
208 | + * @param string $barTitle |
|
209 | 209 | */ |
210 | 210 | public function setBarTitle($barTitle) |
211 | 211 | { |