Skip to content

[Routing] Annotation loader parsing #19283

Closed
@alsma

Description

@alsma

Hello.

I've just found strange issue with routing annotation loader and traits.
I'm getting error Class AppBundle\Controller\getDoctrine does not exist in /path/sf282/src/AppBundle/Controller/. After some debugging I came to \Symfony\Component\Routing\Loader\AnnotationFileLoader::findClass , so probably there some bug.

Here is my project structure
screen shot 2016-07-04 at 16 59 00

I have trait inside controller directory, and routing configured to parse annotations inside directory

app:
    resource: "@AppBundle/Controller/"
    type:     annotation
<?php

namespace AppBundle\Controller;

use Doctrine\Common\Persistence\ManagerRegistry;

use AppBundle\Entity\SomeExistingEntity;

trait SomeTrait
{
    public function getMyRepo()
    {
        return $this->getDoctrine()->getRepository(SomeExistingEntity::class);
    }

    /**
     * @return ManagerRegistry
     */
    abstract protected function getDoctrine();
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions