[Flow] How to retrieve all methods of a class that have a certain annotation?
Christian Loock
chl at vkf-renzel.de
Thu Aug 29 10:11:48 CEST 2013
Hi Robert,
thanks for the quick response. You argument seems to be legit.
I now solved it by using get_class_methods to iterate over all methods
and check everyone with isMethodAnnotatedWith.
I also encoutered a weird bug when writing my own annotations, which
seems to be related to PHPs Reflection Service not working as one would
expect.
I filed a bug report at http://forge.typo3.org/issues/51489 .
This one really confuses me and might be related to a bug in PHP itself...
Am 29.08.2013 10:09, schrieb Robert Lemke:
> Hi Christian,
>
> Christian Loock wrote:
>
>> so I want to get all methodnames of a given class, that have a certain
>> annotation.
>>
>> It seems like, the refelectionservice, only has methods, that retrieve
>> data from a specific method, but none to actually retrieve the methods
>> of a class.
>>
>> Is that the case or did I overlook something?
>
> that's right. You can use
>
> getClassesContainingMethodsAnnotatedWith($annotationClassName)
>
> for retrieving all potential classes which contain methods annotated
> with the annotation you're looking for. Then you'll need to iterate
> over the methods and check their annotations, for example with
>
> isMethodAnnotatedWith($className, $methodName, $annotationClassName)
>
> Why there is no function which does all the work for you? The
> additional cache data we'd need for that information would be huge (we
> had that in the past) which effectively would slow down the whole
> application.
>
> Cheers,
> Robert
>
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list