8000 [DoctrineBridge] Fix detecting mapping with one line annotations by franmomu · Pull Request #48896 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Fix detecting mapping with one line annotations #48896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file 8000
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ private function detectMappingType(string $directory, ContainerBuilder $containe
break;
}
if (
preg_match('/^ \* @.*'.$quotedMappingObjectName.'\b/m', $content) ||
preg_match('/^ \* @.*Embeddable\b/m', $content)
preg_match('/^(?: \*|\/\*\*) @.*'.$quotedMappingObjectName.'\b/m', $content) ||
preg_match('/^(?: \*|\/\*\*) @.*Embeddable\b/m', $content)
) {
$type = 'annotation';
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public function testUnrecognizedCacheDriverException()
public function providerBundles()
{
yield ['AnnotationsBundle', 'annotation', '/Entity'];
yield ['AnnotationsOneLineBundle', 'annotation', '/Entity'];
yield ['FullEmbeddableAnnotationsBundle', 'annotation', '/Entity'];
if (\PHP_VERSION_ID >= 80000) {
yield ['AttributesBundle', 'attribute', '/Entity'];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Fixtures\Bundles\AnnotationsOneLineBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AnnotationsOneLineBundle extends Bundle
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Fixtures\Bundles\AnnotationsOneLineBundle\Entity;

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;

/** @Entity */
class Person
{
/** @Id @Column(type="integer") */
protected $id;

/** @Column(type="string") */
public $name;

public function __construct($id, $name)
{
$this->id = $id;
$this->name = $name;
}

public function __toString(): string
{
return (string) $this->name;
}
}
0