Skip to content

Identifier ends with ::class from Traits has an invalid namespace #378

Description

@hason

How to reproduce
Create the following class and traits using doctrine/orm:

namespace App\Behaviour;

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Embeddable()
 */
class State
{
}
namespace App\Behaviour;

use Doctrine\ORM\Mapping as ORM;

trait StateMachineTrait
{
    /**
     * @ORM\Embedded(class=State::class)
     */
    private ?State $state;
}
namespace App\Entity;

use App\Behaviour\StateMachineTrait;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class Article
{
    use StateMachineTrait;
}

Trying to create a mapping for this setup will throw an MappingException:

Class 'App\Entity\State' does not exist

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions