Hi,

using Netbeans you might use the magic "vdoc" mechanism - i tried it
out and it worked for me. By typing "vdoc" and pressing the tabulator
key, a phpdoc template is generated that allows you to type-hint
variable types at any (!) scope.

An example may look like

/* @var $em \Doctrine\ORM\EntityManager */
$em = $this->get('doctrine.orm.entity_manager');

More information may be found behind this link:
http://blogs.oracle.com/netbeansphp/entry/defining_a_variable_type_in

Nevertheless i am of the opinion that these missing "native" getter
and setter methods is a really annoing thing that rises the learning
curve a lot - a no-go for "framework beginners".

At least there should be a default-controller that implements methods
to return e.g. the interfaces the concrete services implement. So you
could use at least a minimum subset of the php "guessing" code-
completion features in various IDEs - not only netbeans.

Unfortunately i have no idea how to archive this task without breaking
this loose coupling paradigm - perhaps there could be some sort of
code-auto-generating-features (similar to this that doctrine
implements for annotated entity classes) that depend on @method or
@var, or aliased @di:service annotations.This would provide some sort
of "trait" functionality into php ... hm...

On 7 Mai, 17:18, Donald Tyler <chekot...@gmail.com> wrote:
> I don't have this problem so much anymore, but I've been using Symfony 2 for
> quite some time now.
>
> I do however completely agree with you. Not only is the code completion this
> a problem, but having the argument to Controller->get be a string gives
> absolutely no guidance to what the possible values could be. If there were
> actual getters and setters it would be fare more structured.
>
> That being said, I understand why they did it this way. The Symfony 2
> framework is supposed to be completely modular and extendable, so it's not
> possible to know to the valid values for get() until runtime. It all depends
> on what Bundles you're using.
>
> I think your current workaround is the best option at the moment. It will
> allow you as a developer to specify more clearly to your team what
> facilities *your* controllers will have available to them, while not
> imposing a rigid structure on the Framework for other teams.
>
>
>
>
>
>
>
> On Sat, May 7, 2011 at 9:55 AM, Tony Piper <tpi...@tpiper.com> wrote:
> > > I've already considered extending the Controller class to add some of
> > > those functions and having my own Controllers extend that class
> > > But changing my code (specially on this level) to help my editor feels
> > > really stupid ...
>
> > > Am I really the only developer out there who sucks at memorizing
> > > APIs ? or do you guys have some other ways of helping yourself in the
> > > process of working with sf2?
>
> > You are not alone, Ruben and I'd be interested to hear what others
> > have to say about this.
>
> > I have found myself implementing my own Base Controller which
> > provides, amongst other things, easy access to the Entity Manager
> > which is going to be needed in pretty much every controller.
>
> > I watched Fabien's keynote at Symfony Live and was absolutely amazed
> > to see that he uses good 'ol TextMate which doesn't support
> > autocompletion so I wonder if he's ever considered it necessary. I
> > certainly wouldn't be very productive if it were not for PhpStorm's
> > autocomplete goodness.
>
> > cheers,
>
> > Tony.
>
> > --
> > 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 users" group.
> > To post to this group, send email to symfony-users@googlegroups.com
> > To unsubscribe from this group, send email to
> > symfony-users+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/symfony-users?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 users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to