Hi, On Sat, Jul 24, 2010 at 10:53 AM, Tamcy <[email protected]> wrote: > Hi, > > Although a bit late I just started try Symfony2 out. To me it is also > a good chance to try new things including features in PHP 5.3, > Doctrine 2 and MongoDB. So yeah, everything seems new to me. It is > still too early for me to comment on the good or bad of the current > documentation, but there are something that make me feel lost for a > moment. Here are what I encountered visiting 2 particular pages - > Forms and MongoDB, but some issues are general and can apply to other > pages as well. > > First the "Forms" page (http://symfony-reloaded.org/guides/Forms). It > is the code below that make me feel lost: > -------------------------- > # src/Application/HelloBundle/Controller/HelloController.php > public function signupAction() > { > $customer = new Customer(); > > $form = new Form('customer', $customer, $this->container- >>getValidatorService()); > $form->add(new TextField('name')); > $form->add(new IntegerField('age')); > > return $this->render('HelloBundle:Hello:signup', array('form' => > $form)); > } > -------------------------- > > Two suggestions - > > (1) I think the document should be targeted to a) new comers to > Symfony2, or even b) new comers to Symfony2 and PHP 5.3. Symfony2 uses > namspace everywhere. In the above example, "Form", "TextField", > "IntegerField" classes are under the namespace "Symfony\Components > \Form", but are used without any namespace reference. It seems > reasonable to state the namespace explicitly, or add "use" statements > before the public function. > > To me I don't mind reading code like "new Symfony\Components\Form > \Form()", it is clear and verbose, and shouldn't be too verbose as the > example code is short. >
Agreed, we could probably get away with it here. I know in some examples I've written I came to the conclusion that all the fully qualified namespaces made the example hard to read, and adding all the use statements distracted the user from the example itself so I decided to not include the use statements or the fully qualified class name. I think the downside is you have to do some work if you want to copy and paste the code which is what I assume a lot of people do, right? > (2) "$this->container->getValidatorService()" is quite a sudden > introduction, and this method call requires a setup before use. As the > document is ought to be independent I suggest to add a note saying > something like "Validation service needs to be setup first. Please > refer to the Validation documentation". > Can you log a ticket for this or send a pull request? http://trac.symfony-project.org > Then for the "MongoDB" page (http://symfony-reloaded.org/guides/ > Doctrine/MongoDB), also some suggestions: > > (1) It's better to have a note reminding the developer to enable the > DoctrineMongoDBBundle in HelloKernel.php. > > (2) Add "use Application\HelloBundle\Documents\User;" before the class > definition of UserController. > > (3) Not very important, how about a "listAction" for a more complete > feature demonstration: > > public function listAction() > { > $dm = $this->container- >>getService('doctrine.odm.mongodb.document_manager'); > $users = $dm->getRepository('Application\HelloBundle\Documents > \User')->findAll(); > // ... > } > Can you log tickets or send pull requests for the above individual changes? > That's all for now. And finally, any plan for a separate user gruop > for Symfony2? Not sure about devs, but seems essential for users. > I don't think so. We should keep one group and all Symfony2 related posts should be prefixed with [Symfony2] and then you can filter based on that. Thanks, Jon > Thanks again for the great work! > > Tamcy > > -- > 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 [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/symfony-devs?hl=en > -- Jonathan H. Wage http://www.twitter.com/jwage -- 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en
