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
[ZF2] DoctrineAnnotations fails when there is no [space] on the first line ... #331
Comments
@nickurt any backtrace? The exception seems to have nothing to do with annotations... |
|
Nothing related to annotations there... You should debug into it and verify what is being changed in parameters passed from the form builder to the form. |
Ok, /**
* @Annotation\Type("Zend\Form\Element\Text")
* @Annotation\Required({"required":"true" })
* @Annotation\Filter({"name":"StripTags"})
* @Annotation\Options({"label":"FirstName", "placement":"prepend"})
* @Annotation\Attributes({"placeholder":"John", "id":"first_name", "class":"form-control", "autofocus":true})
* @Annotation\Decorator("name":"label")
* @Annotation\Validator({"name":"StringLength","options":{"min":2,"max":64}})
*/
public $first_name; Without [space] on first line gives met this ( $form->get('first_name') )
And with [space] on the first line gives me this
|
Can you try reading those with the raw annotation reader? |
$reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reflClass = new \ReflectionProperty('\Profile\Form\Settings', 'first_name');
$classAnnotations = $reader->getPropertyAnnotations($reflClass); Gives me (with space/without spaces) gives me ...
|
@nickurt so there's no differences in the annotation reader logic? Are you also checking if the opcode cache is cleared? |
Nope, Cleared the cache already on dev/live server, it only works on my dev server and not on the live server ... This threads seems to be related to it |
@Ocramius Any updates what I can do/how to solve it? |
Another one ... $reader = new \Doctrine\Common\Annotations\AnnotationReader();
$reflProperty = new \ReflectionProperty('\EventsPayments\Form\Payments\CreatePaymentIdeal', 'amount');
$propAnnotations = $reader->getPropertyAnnotations($reflProperty);
Becomes <input name="amount" type="text" value="0.01"> In the layout ... |
@nickurt I'm thinking that this is a I suggest checking the output near https://github.com/zendframework/zf2/blob/fc50881c9b44e6e0e426edb3d9c2b2a1311ef97a/library/Zend/Code/Annotation/Parser/DoctrineAnnotationParser.php#L101, being especially careful about what is being passed to the annotation parser. |
@Ocramius Ok, is it good to continue this thread, or to move to zf2 issues?, Btw, debugged this one, and got this results ... AnnotationClass (with space)
AnnotationClass (without space)
AnnotationString (with space)
AnnotationString (without space)
|
@nickurt yes, this is a zf2 bug. Closing here, please open an issue on the zf2 issue tracker. |
I cannot open issues in the doctrine/annotations repository, so I do it here.
I'm using in Doctrine Annotations (Form Annotations) in Zend2, but it always fails when there is no [space] on the first line ...
Fails:
Works:
Zend gives me this errors ...
Versions
The text was updated successfully, but these errors were encountered: