Let's go explicit: 1 +1 ;-)

On Nov 30, 8:21 pm, Jeremy Mikola <jmik...@gmail.com> wrote:
> I was going to suggest Thomas' proposal, since "resource" seems redundant in
> the YML examples (what else would you be importing if not other
> resources?).  However, after noting some of the replies after, I decided to
> consider alternative formats, such as XML and PHP:
>
> See:http://docs.symfony-reloaded.org/quick_tour/the_big_picture.html#routing
>
> YML: { resource: HelloBundle/Resources/config/routing.yml }
> XML: <import resource="HelloBundle/Resources/config/routing.xml" />
> PHP: $routeCollection->import('HelloBundle/Resources/config/routing.php');
>
> Resource seems akin to a URI here, so in that sense prefixing the loader as
> a "protocol" before it makes sense.  But as Johannes mentioned, it can
> easily be confused for key:value syntax in YML and when I consider the
> <import> tag in XML, I'm on the fence if the "protocol" is best specified as
> a prefix in the resource attribute or as its own explicit attribute.
>
> One alternative that comes to mind is:
>
> YML: { resource: HelloBundle/Controller/HelloController.php, type:
> annotation }
> XML: <import resource="HelloBundle/Controller/HelloController.php"
> type="annotation" />
> PHP: $routeCollection->import('HelloBundle/Resources/config/routing.php',
> 'annotation');
>
> "Loader" may be a better key to use than "type".  Also, in the PHP example,
> possible variations might be defining constants for the built-in loaders or
> perhaps having extra helper/convenience methods, such as
> importAnnotations($resource).
>
> In conclusion, I'd say if we go with the protocol/prefix convention, it
> would always be enforced (like a true URI).  But if an extra
> key/attribute/argument (YML/XML/PHP, respectively) is to be used to denote
> the loader, we can make it optional and only required for the ambiguous
> cases (e.g. if the file extension is .php).
>
> On Tue, Nov 30, 2010 at 3:55 AM, Thomas Rabaix <thomas.rab...@gmail.com>wrote:
>
> > Why not keep thing simple :
>
> > imports:
> >  - { file: BlogBundle/Controller/AnnotController.php }
> >  - { annotations: BlogBundle/Controller/AnnotController.php }
>
> > ?
>
> --
> jeremy mikola

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to