Giter VIP home page Giter VIP logo

Comments (5)

PowerKiKi avatar PowerKiKi commented on June 13, 2024

It would seems like you are using a \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain, as opposed to a simple \Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver. In that case you should define a default driver in that chain. So that we can use that default driver as a fallback to read trait's annotations.

Basically you want to go in that if:

if ($this->chainDriver->getDefaultDriver() instanceof AnnotationDriver) {
return $this->chainDriver->getDefaultDriver()->getReader();
}
throw new Exception('graphql-doctrine requires ' . $className . ' entity to be configured with a `' . AnnotationDriver::class . '`.');
}

Let me know if that helps

from graphql-doctrine.

PowerKiKi avatar PowerKiKi commented on June 13, 2024

It would seems like you are using a \Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain, as opposed to a simple \Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver. In that case you should define a default driver in that chain. So that we can use that default driver as a fallback to read trait's annotations.

Basically you want to go in that if:

if ($this->chainDriver->getDefaultDriver() instanceof AnnotationDriver) {
return $this->chainDriver->getDefaultDriver()->getReader();
}
throw new Exception('graphql-doctrine requires ' . $className . ' entity to be configured with a `' . AnnotationDriver::class . '`.');
}

Let me know if that helps

from graphql-doctrine.

popovserhii avatar popovserhii commented on June 13, 2024

Yes, you suggestion helped me but this is not obviously.
I thing it would be better if AnnotationDriver for Trait has taken from Model, such as Trait is subject of Model. Some projects can already have defaultDriver set to YamlDriver or XmlDriver and change this option can not be possible.

from graphql-doctrine.

PowerKiKi avatar PowerKiKi commented on June 13, 2024

I agree with you. It would be best to use the model class, instead of the trait class.

However we don't use MappingDriverChain in our projects and I won't work on that feature. But if you are interested in it, feel free to submit a PR, covered by unit tests, then I would merge it.

from graphql-doctrine.

popovserhii avatar popovserhii commented on June 13, 2024

Ok, I will try.

from graphql-doctrine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.