-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Anotation "@Enum" was never imported error #380
Comments
@schmittjoh I'm closing this as this issue seems not to be related with this bundle but with sylius resource bundle, sorry about this! |
Hi,
|
@SpadesTheOriginal which version of |
I'm not using doctrine/annotations. That's why I'm confused, yet I have the same error as the OP. I'm using JMS\Serializer\Annotation |
@SpadesTheOriginal JMSSerializer uses the |
Do I need to specify "use doctrine\annotations" in my user class then ? |
It is not a class. It is a composer package. I'm asking you which version of this package is used in your project. |
doctrine/annotations v1.2.0 |
then it is really weird |
i have same issue
and only when using Doctrine\ORM\Tools\Pagination\Paginator; |
I had the same error, the problem was my fault, because after using createQueryBuilder(), I forgot to add ->getQuery()->getResult(). |
@solazs, you just save me some time wasting! |
@solazs Same here, thanks ! +1 for a comprehensive error message :) |
@solazs can you write down an example? I'm also in trouble... I checked composer show -i. And as I just checked I'm using the last of everything :( |
(message deleted to avoid confusion) |
@solazs never mind. Solved :'p I was trying to parse an Paginator instance with JMSSearializer (I'm using FOS Rest). //...on the repo
$query->orderBy('o.created', 'ASC')
->setMaxResults($maxResults)
->setFirstResult($firstResult);
$paginator = new Paginator($query, true);
try {
return $paginator;
} catch (\Doctrine\ORM\NoResultException $e) {
return null;
}
//...on the fos rest controller
//Paginator object returned
$paginatorResult = $em->getRepository('BicEntityBundle:Whatever')->findSearched($what, $firstResult, $nResults);
return $this->handleView(
$this->view(
//because Paginator class implements IteratorAggregate
$paginatorResult->getIterator()->getArrayCopy(), 200
)
//just to create the pagination
->setHeader('n_results', count($paginatorResult))); Hope it helps someone. |
Im still gettig this error:
Im just trying to serialize a paginator object:
These are my composer.json packages installed:
|
You can not parse paginator object straight away (JMSSerializer is not prepared for that), do the following:
|
If you are using PagerFanta as your paginator, you must do something like this:
|
@solazs 👍 for saving my time :) |
Very helpful guys Thanks!! |
Hi, i have the same issue but when i use Doctrine\Common\Collections\Criteria to find rows: [Semantical Error] The annotation "@Enum" in property Doctrine\ORM\Mapping\GeneratedValue::$strategy was never imported. Did you maybe forget to add a "use" statement for this annotation? When i use $oItemsRows = $this->getEntityManager()->getRepository('Application\Entity\Item')->findBy(array(), $aOrder, $iLimit); is serialized right but when i use: $oCriteria = Criteria::create();
$oCriteria->setMaxResults(2);
$oItemsRows = $this->getEntityManager()->getRepository('Application\Entity\Item')->matching($oCriteria); i got error... Any suggestion? Regards |
I guess that the object returned is not an array. |
@solazs solution worked for me 👍 |
@solazs TY man, it's help. |
Hi guys,
I'm having an error trying to serialize an Doctrine Entity. I get the following error:
The entity has excluded all the properties explicitly, and some are exposed with the
@Expose
method. Here is the code:So, I don't have any ideas what could be wrong. It seems that the doctrine anotations are not being loaded correctly in the anotations I use here.
I've read a similar issue here but it's not a proxy issue so I have no idea how to solve this (as the property that has the ManyToOne is excluded, as you can see in the code above; only the present properties are exposed).
So.. is this a bug? Or I'm missing some config? Any ideas?
Thanks a lot for your help!
The text was updated successfully, but these errors were encountered: