[fw-general] Re: [zf-contributors] Survey: to composer or not to composer
On 30 May 2013 22:45, Matthew Weier O'Phinney matt...@zend.com wrote: Composer simply... simplifies... usage. I think this is the most important thing for me. While the concept of libraries existed for Composer and ZF2, I usually ended up either writing my own code to do the same thing or using chopped up bits of libraries I found. Composer has really improved the way I work, to such an extent that all new projects I am doing have so little code written by me I feel like I am scamming the client :p I still use Zend\Loader for the internal application modules that will never touch another project. My ZF2 is loaded via composer. Regards, Michael Gooden
Re: [fw-general] Re: [zf-contributors] Survey: to composer or not to composer
Loader I'm used to ZF1 and I haven't had the time to dive into the composer yet. I'll be sure to check it out once I get a grip of the rest of the ZF2 practices. For someone like me, that have limited time to learn ZF2 before putting it into production, the loader provides a little more familiarity to get me going. Regards, Björn 2013/5/30 Matthew Weier O'Phinney matt...@zend.com On Thu, May 30, 2013 at 12:13 PM, Marco Pivetta ocram...@gmail.com wrote: Hi everybody! tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with loader or composer :) Both. Modules inside my application that do not need to be re-used will use Zend\Loader, while those that are installable via Composer will use composer. That said, I don't like to limit installation options for users of my modules, either; if they want to add them as git submodules, or download them and deflate them into their application, that's fine, too -- and that's where having Zend\Loader available as an autoloading mechanism makes sense. Composer simply... simplifies... usage. -- Matthew Weier O'Phinney Project Lead| matt...@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] [zf2] Help me understand routing
Thank you both! I'll try that and report. On Tue, May 28, 2013 at 1:12 AM, Michael Gooden mich...@bluepointweb.comwrote: Hi Xander, Matus is correct, routes are examined in LIFO order by default, unless you specify an explicit priority. This is important to remember when adding routes in modules, as the order the modules are loaded in your Application could affect your routing setup. Cheers, Michael Gooden On 28 May 2013 03:44, Matus Zeman matus.ze...@gmail.com wrote: Have you tried adding 'create' route after 'profile' one? Matus On 28 May 2013 08:41, Xander Guzman thesha...@shadowpedia.info wrote: I have the following route defined 'campaigns' = array( 'type'= 'Zend\Mvc\Router\Http\Literal', 'options' = array( 'route'= 'campaigns', 'defaults' = array( 'controller' = 'Application\Controller\Campaigns', 'action' = 'index', ), ), 'may_terminate' = true, 'child_routes' = array( 'create' = array( 'type' = 'Zend\Mvc\Router\Http\Literal', 'options' = array( 'route' = '/create', 'action' = 'create', ), ), 'profile' = array( 'type'= 'Zend\Mvc\Router\Http\Segment', 'options' = array( 'route'= '/:campaign-slug', 'defaults' = array( 'action' = 'campaign', ), ), 'may_terminate' = true, 'child_routes' = array() ), My problem is the way I'm understanding it if I type in /campaigns/create it should map to /create and if I enter anything else /campaigns/foofoobunny that should match the /:campaign-slug route. Problem is that it doesn't work, why is this? How could I make it so if I define an explicit route it will match and if it doesn't it falls back to this default dynamic route?
[fw-general] Re: [zf-contributors] Survey: to composer or not to composer
both although using composer more and more David On 31/05/2013, at 3:13 AM, Marco Pivetta ocram...@gmail.com wrote: Hi everybody! tl;dr: ZF2: do you use composer or Zend\Loader? Simply reply with loader or composer :) I've been discussing on IRC about dropping the pre-configured Zend\Loader instance in standard MVC applications (we're discussing that for ZF3). Since I was asserting that most users do use composer for autoloading their stuff, I got told to get proof of that - so please just drop me a line :) The main idea is to move away from configuring autoloading per-library and instead use composer to autoload everything. Here's how the config of a composer.json file would look: { autoload: { psr-0: { MyLib: path/to/my-lib } } } Here's how it would look with Zend\Loader: include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(array( 'Zend\Loader\StandardAutoloader' = array( 'autoregister_zf' = true, 'namespaces' = array( 'MyLib' = path/to/my-lib, ), ) )); The main difference here is that composer requires us to run `composer dump-autoload` before being able to use `MyLib` The idea is NOT about dropping Zend\Loader, but just removing the initialization logic from the skeleton application. If you also have thoughts except for your preference, please share! Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/
[fw-general] How to deploy skeleton application without composer
Hi, It's the buzz word nowday :) but what's the way to install skeleton application without composer ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
Re: [fw-general] How to deploy skeleton application without composer
Just `git clone --recursive` ;) On 31 May 2013 21:26, whisher whishe...@gmail.com wrote: Hi, It's the buzz word nowday :) but what's the way to install skeleton application without composer ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Re: How to deploy skeleton application without composer
Thanks :) but if don't us composer init_autoloader do all the work ? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-to-deploy-skeleton-application-without-composer-tp4660184p4660186.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com
[fw-general] Re: ZF2 - RESTful API for nested resources
Heya! As you may have noticed, I and Michael Gallego (Bakura) have been working on ZfrRest lately. It is a doctrine-related library, so not for everyone out there, but here's some answers for you (you may as well check out the library!). POST /users/[userId]/customers - adds a customer to that particular collection for the user DELETE /users/[userId]/customers/[customerId] - removes a particular customer from the collection of customers of that particular users (may remove it completely if necessary, but that's up to your business logic) ZfrRest basically builds the first step for you: retrieving the resource (collection, item or association) and passes it to a designated controller (which can be configured by collection, association or item). Then it's up to the controller to decide what to do. If you come up with a mental model that fits your needs, you can just use the same two controllers (one for a collection, one for a single item - yes, those are different resource types and have to be handled separately!) for every mapped resource. Just my 2 cents Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 31 May 2013 22:47, esheffield [via Zend Framework Community] ml-node+s634137n4660188...@n4.nabble.com wrote: Hi all, I'm wondering if anyone out there in the community has any experience with RESTful APIs where entities have associations. In my application, for example, I have two Doctrine entities, user and customer, which have a many-to-many relationship. With REST, I can call: GET /users/[userId] to get information associated with a user like first name, email, etc. However, because of the many-to-many relationship, a user also has a collection of Customers as one its properties. To get information about this relationship I would call GET /users/[userId]/customers or GET /users/[userid]/customers/[customerId] This works well enough, but what should happen if you were to do a POST, PUT, or DELETE to one of those routes? How should it behave? For example, should DELETE /users/[userid]/customers/[customerId] actually remove that customer from the database, or just remove it from that user's collection of customers? One thought I've had is to keep such routes as GET only, essentially as convenience for getting information about associations. But then how would you add/remove associations? You could make PUTs to /users/[userId] and /customer/[customerId], but this would require some added complexity in the REST controllers to find the proper resource and add it to or remove it from the collection. If anyone has any best practices or thoughts on how to design this kind of REST api, it would be greatly appreciated. I'd also be curious how people have approached this problem from a ZF2 perspective in terms of setting up the routes and controllers. Thanks! Evan Sheffield iVantage Health Analytics -- If you reply to this email, your message will be added to the discussion below: http://zend-framework-community.634137.n4.nabble.com/ZF2-RESTful-API-for-nested-resources-tp4660188.html To start a new topic under Zend Framework, email ml-node+s634137n634138...@n4.nabble.com To unsubscribe from Zend Framework Community, click herehttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=634137code=b2NyYW1pdXNAZ21haWwuY29tfDYzNDEzN3wxNzE0OTI1MTk4 . NAMLhttp://zend-framework-community.634137.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/ZF2-RESTful-API-for-nested-resources-tp4660188p4660190.html Sent from the Zend Framework mailing list archive at Nabble.com.