I'm trying to create a simple index to a table in Doctrine2 / Symfony2 using annotations and I'm getting the following error:
[Semantical Error] The annotation "@Index" in class {My\Namespaces\Here} was never imported. Did you maybe forget to add a "use" statement for this annotation?
I can't find in any documentation what namespace I'm supposed to "use" to add the Index functionality. Here's my annotation:
@ORM\Table(indexes={@Index(name="email_address_idx", columns={"email_address"})})
And here are the namespaces I'm already using:
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
What namespace do I need to use to add this functionality?
Looks like you need:
@ORM\Table(indexes={@ORM\Index(name="email_address_idx", columns={"email_address"})})
You can use the following to solve the issue:
use Doctrine\ORM\Mapping\Index;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With