Skip to content

Commit f15fa38

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [DoctrineBridge] Fix auto mapping for bundles that contain only embeddables [String] Update wcswidth data with Unicode 15 [Messenger] Fix default serializer not handling DateTime objects properly
2 parents 320a14e + 5db7ac5 commit f15fa38

File tree

6 files changed

+132
-2
lines changed

6 files changed

+132
-2
lines changed

DependencyInjection/AbstractDoctrineExtension.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,16 @@ private function detectMappingType(string $directory, ContainerBuilder $containe
294294
foreach ($glob as $file) {
295295
$content = file_get_contents($file);
296296

297-
if (preg_match('/^#\[.*'.$quotedMappingObjectName.'\b/m', $content)) {
297+
if (
298+
preg_match('/^#\[.*'.$quotedMappingObjectName.'\b/m', $content) ||
299+
preg_match('/^#\[.*Embeddable\b/m', $content)
300+
) {
298301
break;
299302
}
300-
if (preg_match('/^ \* @.*'.$quotedMappingObjectName.'\b/m', $content)) {
303+
if (
304+
preg_match('/^ \* @.*'.$quotedMappingObjectName.'\b/m', $content) ||
305+
preg_match('/^ \* @.*Embeddable\b/m', $content)
306+
) {
301307
$type = 'annotation';
302308
break;
303309
}

Tests/DependencyInjection/DoctrineExtensionTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ public function testUnrecognizedCacheDriverException()
276276
public function providerBundles()
277277
{
278278
yield ['AnnotationsBundle', 'annotation', '/Entity'];
279+
yield ['FullEmbeddableAnnotationsBundle', 'annotation', '/Entity'];
279280
yield ['AttributesBundle', 'attribute', '/Entity'];
281+
yield ['FullEmbeddableAttributesBundle', 'attribute', '/Entity'];
280282
yield ['XmlBundle', 'xml', '/Resources/config/doctrine'];
281283
yield ['PhpBundle', 'php', '/Resources/config/doctrine'];
282284
yield ['YamlBundle', 'yml', '/Resources/config/doctrine'];
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Fixtures\Bundles\FullEmbeddableAnnotationsBundle\Entity;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Embeddable;
16+
use Doctrine\ORM\Mapping\Id;
17+
18+
/**
19+
* @Embeddable
20+
*/
21+
class Address
22+
{
23+
24+
/** @Column(type="string") */
25+
public $street;
26+
27+
/** @Column(type="string") */
28+
public $zipCode;
29+
30+
/** @Column(type="string") */
31+
public $city;
32+
33+
public function __construct($street, $zipCode, $city)
34+
{
35+
$this->street = $street;
36+
$this->zipCode = $zipCode;
37+
$this->city = $city;
38+
}
39+
40+
public function __toString(): string
41+
{
42+
return sprintf('%s %s %s', $this->street, $this->zipCode, $this->city);
43+
}
44+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Fixtures\Bundles\FullEmbeddableAnnotationsBundle;
13+
14+
use Symfony\Component\HttpKernel\Bundle\Bundle;
15+
16+
class FullEmbeddableAnnotationsBundle extends Bundle
17+
{
18+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Fixtures\Bundles\FullEmbeddableAttributesBundle\Entity;
13+
14+
use Doctrine\ORM\Mapping\Column;
15+
use Doctrine\ORM\Mapping\Embeddable;
16+
use Doctrine\ORM\Mapping\Id;
17+
18+
#[Embeddable]
19+
class Address
20+
{
21+
22+
#[Column(type: 'string')]
23+
public $street;
24+
25+
#[Column(type: 'string')]
26+
public $zipCode;
27+
28+
#[Column(type: 'string')]
29+
public $city;
30+
31+
public function __construct($street, $zipCode, $city)
32+
{
33+
$this->street = $street;
34+
$this->zipCode = $zipCode;
35+
$this->city = $city;
36+
}
37+
38+
public function __toString(): string
39+
{
40+
return sprintf('%s %s %s', $this->street, $this->zipCode, $this->city);
41+
}
42+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Fixtures\Bundles\FullEmbeddableAttributesBundle;
13+
14+
use Symfony\Component\HttpKernel\Bundle\Bundle;
15+
16+
class FullEmbeddableAttributesBundle extends Bundle
17+
{
18+
}

0 commit comments

Comments
 (0)