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 Di-Extra phpdoc-like injecting
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marco Pivetta  
View profile  
 More options Oct 22 2012, 4:41 pm
From: Marco Pivetta <ocram...@gmail.com>
Date: Mon, 22 Oct 2012 22:41:30 +0200
Local: Mon, Oct 22 2012 4:41 pm
Subject: Re: [symfony-devs] Di-Extra phpdoc-like injecting

Annotations in Doctrine Common are meant to fill a gap of annotations
missing in PHP. Their meaning is exactly what you'd meet in Java or C#.
They are a workaround since the annotations RFC didn't make it to PHP core.
Consider them as if they were _EXACTLY_ Java annotations.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 22 October 2012 22:25, Nikita Nefedov <inefe...@gmail.com> wrote:

> Yep, I understand. But as long as php don't have annotations like in Java,
> our "annotations" is just comments.
> Don't get me wrong, I'm not against annotations, but this just looks ugly.
> Either way, they are handy, because they are right near to code they
> related to, but we don't have annotation mechanism like Java have and we
> shouldn't use it like Java forces Java-ers to use it just because it's not
> Java (or C#).

> On Monday, October 22, 2012 11:01:15 PM UTC+4, Marco Pivetta wrote:

>> While PHPDoc is metadata that is useful and does not have effect on how
>> code behaves, annotations are a quite different concept coming from the
>> java world (where they're actually a construct recognized by the language).
>> Don't confuse them, they should not be mixed up. One provides some sort
>> of functionality, the other is just descriptive.

>> Marco Pivetta

>> http://twitter.com/Ocramius

>> http://ocramius.github.com/

>> On 22 October 2012 09:15, Nikita Nefedov <inef...@gmail.com> wrote:

>>>  Hi,

>>> I just though, why we are using so complicated style for declaring
>>> dependencies in annotations?
>>> Look: if I want to create some service, that are depends on request,
>>> entity_manager, etc. I need to write that (sorry, don't know how to format
>>> code here):

>>> use JMS\DiExtraBundle\Annotation\Service,
>>>       JMS\DiExtraBundle\Annotation\Inject,
>>>       JMS\DiExtraBundle\Annotation\InjectParams;

>>> /**
>>>  * @Service
>>>   */
>>> class Service
>>> {

>>>     /**
>>>      * @InjectParams({
>>>      *   "request" = @Inject("request"),
>>>      *   "em"       = @Inject("doctrine.orm.entity_manager"),
>>>      *   ...
>>>      * })
>>>      */
>>>     public function __construct($request, $em, ...) {}
>>> ....
>>> }

>>> But can't we just use default @param annotation for that purposes?
>>> For our example it would be:

>>> use JMS\DiExtraBundle\Annotation\Service,
>>>       Symfony\Component\HttpFoundation\Request,
>>>       Doctrine\ORM\EntityManager;

>>> /**
>>>  * @Service
>>>  */
>>> class Service
>>> {

>>>     /**
>>>      * @param Request $request "request"
>>>      * @param EntityManager $em "doctrine.orm.entity_manager"
>>>      */
>>>     public function __construct($request, $em, ...) {}
>>> ....
>>> }

>>> The thing is: we are already at that point, where all this annotations
>>> became ridiculously big (I mean, they are taking more space than code
>>> itself) and from other side - we always write phpdocs, just for documenting
>>> our code. So, why not use phpdocs, that are already can give us a lot of
>>> information, instead of creating a lot of classes for annotations?
>>>  --
>>> If you want to report a vulnerability issue on symfony, please send it
>>> to security at symfony-project.com

>>> You received this message because you are subscribed to the Google
>>> Groups "symfony developers" group.
>>> To post to this group, send email to symfon...@googlegroups.com

>>> To unsubscribe from this group, send email to
>>> symfony-devs...@googlegroups.com

>>> For more options, visit this group at
>>> http://groups.google.com/group/symfony-devs?hl=en

>>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com

> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to symfony-devs@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.