Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Best Practices: Adding to Doctrine's AnnotationReader::$globalIgnor edNames

Received: by 10.224.183.13 with SMTP id ce13mr5107406qab.4.1349351142202;
        Thu, 04 Oct 2012 04:45:42 -0700 (PDT)
X-BeenThere: symfony2@googlegroups.com
Received: by 10.224.101.68 with SMTP id b4ls4544942qao.0.gmail; Thu, 04 Oct
 2012 04:45:38 -0700 (PDT)
Received: by 10.224.183.13 with SMTP id ce13mr5107340qab.4.1349351138483;
        Thu, 04 Oct 2012 04:45:38 -0700 (PDT)
Received: by 10.224.28.72 with SMTP id l8msqac;
        Wed, 3 Oct 2012 11:20:53 -0700 (PDT)
Received: by 10.236.183.101 with SMTP id p65mr354491yhm.20.1349288452706;
        Wed, 03 Oct 2012 11:20:52 -0700 (PDT)
Date: Wed, 3 Oct 2012 11:20:51 -0700 (PDT)
From: Olivier Finlay Beaton <olivier.bea...@gmail.com>
To: symfony2@googlegroups.com
Message-Id: <87e924cf-be45-410f-bf4b-4363ecc6f024@googlegroups.com>
In-Reply-To: <b1fc6ad3-b62b-4fcb-95c7-97feddf23068@googlegroups.com>
References: <b1fc6ad3-b62b-4fcb-95c7-97feddf23068@googlegroups.com>
Subject: Re: Best Practices: Adding to Doctrine's
 AnnotationReader::$globalIgnoredNames
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_780_27558094.1349288452095"

------=_Part_780_27558094.1349288452095
Content-Type: multipart/alternative; 
	boundary="----=_Part_781_17073520.1349288452095"

------=_Part_781_17073520.1349288452095
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

I've got this same problem, and asking in IRC over the last few days hasn't 
gotten any responses. Other phpDocumentor and Doctrine annotations are not 
supported, like @note

I also found the doctrine doc above but have no idea where in my project to 
add the addGlobalIgnoredName

I found in the symfony docs that you should use @IgnoreAnnotation but that 
 requires you to specify them on a per-controller/class basis for every 
annotation you want to ignore. This could get tedious.

The I thought hey, I'll just make my own annotation with a fake do-nothing 
annotation class! Made a Note class, and this works however now I need to 
add a use statement for every annotation I wat to ignore, in every 
controller/class. Not any further ahead. Is there a way to get them 
registered at the top level so I don't have to use; them?

Or maybe there is another way to ignore an annotation? I seems so unlikely 
that this is an isolated problem given all the auto-generated documentation 
people use.

brensch in IRC did mention that there is a annotation reader service, and 
somehow you may be able to use this? He did mention that he was not able to 
get it early enough to use it, and wasn't sure how to proceed. 

I'm new to all this so pardon me if things are not easy for me to find...
- Finlay

On Wednesday, September 12, 2012 11:26:53 AM UTC-4, isleshocky77 wrote:
>
> So I've recently realized that if you're using Doctrine2's annotiations in 
> Entity classes that you have to make sure annotations you add are on the 
> ignore list or it will throw exceptions.  Two annotations I use very 
> frequently are @TODO and @FIXME so I can template something out and come 
> back to it.  However these throw exceptions when trying to do 
> database:create or schema:update
>
> [Doctrine\Common\Annotations\AnnotationException]                         
>                                                                             
>                                                  
> [Semantical Error] The annotation "@fixme" in property 
> Example\ExampleBundle\Entity\Attraction::$heroCheckin was never imported. 
> Did you maybe forget to add a "use" statement for this annotation? 
>
>
> Ok, so I need to add to the white list, from the documentation it should 
> be accomplished with the following:
>
> $reader = new AnnotationReader();
> AnnotationReader::addGlobalIgnoredName('fixme');
>
>
> I'm trying to figure out best practice for where to add this within my 
> Symfony2 bundle so as to have the lease impact on performance. I believe it 
> really only needs to be called when doctrine2 is reading annotations in so 
> I don't know if adding it to Example\ExampleBundle::boot() would be the 
> best place for it.
>
> Any help would be greatly appreciated.
>

------=_Part_781_17073520.1349288452095
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

I've got this same problem, and asking in IRC over the last few days hasn't=
 gotten any responses. Other phpDocumentor and Doctrine annotations are not=
 supported, like @note<div><br></div><div>I also found the doctrine doc abo=
ve but have no idea where in my project to add the addGlobalIgnoredName</di=
v><div><br></div><div>I found in the symfony docs that you should use @Igno=
reAnnotation but that &nbsp;requires you to specify them on a per-controlle=
r/class basis for every annotation you want to ignore. This could get tedio=
us.</div><div><br></div><div>The I thought hey, I'll just make my own annot=
ation with a fake do-nothing annotation class! Made a Note class, and this =
works however now I need to add a use statement for every annotation I wat =
to ignore, in every controller/class. Not any further ahead. Is there a way=
 to get them registered at the top level so I don't have to use; them?</div=
><div><br></div><div>Or maybe there is another way to ignore an annotation?=
 I seems so unlikely that this is an isolated problem given all the auto-ge=
nerated documentation people use.</div><div><br></div><div>brensch in IRC d=
id mention that there is a annotation reader service, and somehow you may b=
e able to use this? He did mention that he was not able to get it early eno=
ugh to use it, and wasn't sure how to proceed.&nbsp;</div><div><br></div><d=
iv>I'm new to all this so pardon me if things are not easy for me to find..=
.</div><div>- Finlay</div><div><div><br>On Wednesday, September 12, 2012 11=
:26:53 AM UTC-4, isleshocky77 wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;">So I've recently realized that if you're using Doctrine2's annotiatio=
ns in Entity classes that you have to make sure annotations you add are on =
the ignore list or it will throw exceptions. &nbsp;Two annotations I use ve=
ry frequently are @TODO and @FIXME so I can template something out and come=
 back to it. &nbsp;However these throw exceptions when trying to do databas=
e:create or schema:update<div><br></div><blockquote style=3D"margin:0 0 0 4=
0px;border:none;padding:0px"><div><div>[Doctrine\Common\Annotations\<wbr>An=
notationException] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp=
; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp;</div></div><div><div>[Semantical Error] The annotation "=
@fixme" in property Example\ExampleBundle\Entity\<wbr>Attraction::$heroChec=
kin was never imported. Did you maybe forget to add a "use" statement for t=
his annotation?&nbsp;</div></div></blockquote><div><br></div><div>Ok, so I =
need to add to the white list, from the documentation it should be accompli=
shed with the following:</div><div><br></div><blockquote style=3D"margin:0 =
0 0 40px;border:none;padding:0px"><div><div>$reader =3D new AnnotationReade=
r();</div></div><div><div>AnnotationReader::<wbr>addGlobalIgnoredName('fixm=
e');</div></div></blockquote><div><br></div><div>I'm trying to figure out b=
est practice for where to add this within my Symfony2 bundle so as to have =
the lease impact on performance. I believe it really only needs to be calle=
d when doctrine2 is reading annotations in so I don't know if adding it to&=
nbsp;Example\ExampleBundle::<wbr>boot() would be the best place for it.</di=
v><div><br></div><div>Any help would be greatly appreciated.</div></blockqu=
ote></div></div>
------=_Part_781_17073520.1349288452095--

------=_Part_780_27558094.1349288452095--