[symfony-users] Re: PR7 Accessing config.yml parameters variables
On 17 mar, 22:49, Christophe COEVOET s...@notk.org wrote: Le 17/03/2011 18:01, Lideln a crit : Hi, I'm trying to use Twig, and I would like to do a simple thing : Display the parameters.title value defined in my config.yml file. I found how to display http query parameters, but not config params (the class GlobalVariables does not contain a getParameters function). Should I add a getContainer function in GlobalVariables so that I can use then : app.container.parameters.title ? I find it weird to modify the core framework. Parameters are not intended to be available in the templates as most of them have nothing to do with the view. You can add global variables in the Twig config and using the parameter placeholder syntax allows to use parameters for this: twig: # ... other Twig config globals: my_param: %some.dic.param% pi: 3.14 Thank you ! I was wanting to display a default title that would be configurable in app.yml (a file I created and imported into config.yml) Your solution is very good, thanks ! Also, is there a var_dump function in Twig to debug variables ? Because it's quite hard to debug scripts. You can activate the debug extension which provide a debug tag. {% debug %} will dump all variables of the context and {% debug my_var %} will only dump the given variable. twig: # ... other Twig config extensions: [twig.extension.debug] # you can add other ones in the array, like twig.extension.text Here again, it is great ! Before posting here I googled everything and I found the debug instruction, but I was not aware of the activation in the config.yml. Instead of asking around, is there a place where I can learn all those things you kindly explained to me ? I read the documentation at both the Twig and the Symfony 2 websites, but I could not find those answers. Thanks again !! Renaud Thank you, -- Christophe | Stof -- 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
[symfony-users] Re: Symfony 2 Doctrine Database Schema imports
Hi, First of all you need to configure your app properly (config.yml), for example : doctrine: dbal: driver: %database_driver% host: %database_host% dbname: %database_name% user: %database_user% password: %database_password% logging: %kernel.debug% orm: auto_generate_proxy_classes: %kernel.debug% mappings: YourBundle: ~ Then ou have to use, for example : php app/console doctrine:mapping:import YourBundle yml Although I noticed a bug, you have to fix ImportMappingDoctrineCommand.php line 77. After that, you need to use the console to generate entities and repositories. Good luck On 16 mar, 21:09, Kelvio Matias kelvio.mat...@gmail.com wrote: I'm working with Symfony 2 and possess a database already exists. I wonder how to create classes it from existing stock. Thanks. -- 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
[symfony-users] PR7 Strange ORM behavior
Hi ! I am trying the database functionalities in PR7. I am experiencing a strange ORM behavior. Here is my code : [code] $qb = $this-get('doctrine.orm.entity_manager')-createQueryBuilder(); $aGalleries = $qb-select('g')-from('SWMainBundle:Gallery', 'g')- where($qb-expr()-eq('g.active', 1))-getQuery()-execute(); [/code] It gave me 5 results (which is good), but all the results where identical (identical to the first result). If I use the DBAL instead, I get my proper 5 results. Why is that ? Thank you, -- 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
[symfony-users] PR7 Accessing config.yml parameters variables
Hi, I'm trying to use Twig, and I would like to do a simple thing : Display the parameters.title value defined in my config.yml file. I found how to display http query parameters, but not config params (the class GlobalVariables does not contain a getParameters function). Should I add a getContainer function in GlobalVariables so that I can use then : app.container.parameters.title ? I find it weird to modify the core framework. Also, is there a var_dump function in Twig to debug variables ? Because it's quite hard to debug scripts. Thank you, -- 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
[symfony-users] Re: Fatal errors (new xsd and class not found)
Ok friends you can forget about it, I guess the version of the zip file I downloaded was corrupted. I downloaded it again (for the third time :) ) and now it works (with small adjustments) ! Thanks for your answers anyway ! On 14 mar, 23:51, Alex Pilon alex.pi...@gmail.com wrote: Google translate the spanish? On Mon, Mar 14, 2011 at 03:58, Lideln lid...@gmail.com wrote: Nobody ? The only other case I found on google was spanish and I didn't understand a word of it :) Don't tell me I'm the only one to have the PR7 not working once downloaded and extracted ? :-/ Any help from one of the developers would be appreciated so I can continue my coding. Thanks in advance, On 11 mar, 05:30, Lideln lid...@gmail.com wrote: Hi, I downloaded the PR7, and got a few fatal errors. On my project first, I updated the files from PR6 and I think I did not forget anything, but I get that error : Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 1845] Element '{http://symfony.com/schema/dic/services} container': No matching global declaration available for the validation root. (in file:///C:/wamp/www/ratethestar/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml - line 5, column 0)' in C:\wamp\www\ratethestar\vendor\symfony\src \Symfony\Component\DependencyInjection\Loader\XmlFileLoader.php on line 396 Then I tried to launch the AcmeDemo just to make sure I did not forget anything, and I got that error : Fatal error: Class 'Symfony\Component\DependencyInjection\Compiler \ResolveDefinitionTemplatesPass' not found in C:\wamp\www \symfony_PR7\vendor\symfony\src\Symfony\Component\DependencyInjection \Compiler\PassConfig.php on line 48 Any ideas ? Thank you all -- 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 -- Alex Pilon (613) 608-1480 -- 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
[symfony-users] Re: Fatal errors (new xsd and class not found)
Nobody ? The only other case I found on google was spanish and I didn't understand a word of it :) Don't tell me I'm the only one to have the PR7 not working once downloaded and extracted ? :-/ Any help from one of the developers would be appreciated so I can continue my coding. Thanks in advance, On 11 mar, 05:30, Lideln lid...@gmail.com wrote: Hi, I downloaded the PR7, and got a few fatal errors. On my project first, I updated the files from PR6 and I think I did not forget anything, but I get that error : Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 1845] Element '{http://symfony.com/schema/dic/services} container': No matching global declaration available for the validation root. (in file:///C:/wamp/www/ratethestar/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml - line 5, column 0)' in C:\wamp\www\ratethestar\vendor\symfony\src \Symfony\Component\DependencyInjection\Loader\XmlFileLoader.php on line 396 Then I tried to launch the AcmeDemo just to make sure I did not forget anything, and I got that error : Fatal error: Class 'Symfony\Component\DependencyInjection\Compiler \ResolveDefinitionTemplatesPass' not found in C:\wamp\www \symfony_PR7\vendor\symfony\src\Symfony\Component\DependencyInjection \Compiler\PassConfig.php on line 48 Any ideas ? Thank you all -- 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
[symfony-users] [PR7] Fatal errors (new xsd and class not found)
Hi, I downloaded the PR7, and got a few fatal errors. On my project first, I updated the files from PR6 and I think I did not forget anything, but I get that error : Fatal error: Uncaught exception 'InvalidArgumentException' with message '[ERROR 1845] Element '{http://symfony.com/schema/dic/services} container': No matching global declaration available for the validation root. (in file:///C:/wamp/www/ratethestar/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/../Resources/config/web.xml - line 5, column 0)' in C:\wamp\www\ratethestar\vendor\symfony\src \Symfony\Component\DependencyInjection\Loader\XmlFileLoader.php on line 396 Then I tried to launch the AcmeDemo just to make sure I did not forget anything, and I got that error : Fatal error: Class 'Symfony\Component\DependencyInjection\Compiler \ResolveDefinitionTemplatesPass' not found in C:\wamp\www \symfony_PR7\vendor\symfony\src\Symfony\Component\DependencyInjection \Compiler\PassConfig.php on line 48 Any ideas ? Thank you all -- 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
[symfony-users] Re: Generating repositories
Hi there ! Ok I succeeded in creating a Repository using your help, and using the annotation type, and modifying the Entities by hand to prepend with orm:. But it is not convenient, and moreover the generated entities are not complete and are overwrited each time (and not merged, so I lose my modifications). I'd rather stick with the yml generation. I use : php app/console doctrine:mapping:import MainBundle yml Then : php app/console doctrine:generate:entities MainBundle And : php app/console doctrine:generate:repositories MainBundle But that last command is stubborn and keeps skipping my Entities. I think I have to modify the generated yml files (Resources/config/ doctrine/metadata/orm/Ratethestar.MainBundle.Entity.Member.dcm.yml), but I could not find tips either in Symfony or Doctrine online tutorials. If anyone knows how to modify my yml file in order not to be skipped during the generate:repositories command, I would love that :) Here is a sample generated yml file : Ratethestar\MainBundle\Entity\Member: type: entity table: member fields: // and so on Thanks to all ! On 24 fév, 20:30, olimination oliminat...@gmail.com wrote: Hi, I'm not an expert too, but I have managed to configure a working custom Repository class for my entity. My main problem was, that I have used a incorrect annotation like this: /** * @orm:Entity * @entity(repositoryClass=Laboda\LabodaAdminBundle\Entity \WishRepository) */ class MyEntityName { ... The problem was that I have used only @entity(repositoryClass=...) instead of @orm:entity(repositoryClass...) And for a correct entity configuration you have to set an id or primary key field, something like that(in annotation form): /** * @orm:Entity * @orm:entity(repositoryClass=MyBundle\Entity \MyEntityRepositoryClass) */ class MyEntityName { /** * @orm:Id * @orm:Column(type=integer) * @orm:GeneratedValue(strategy=IDENTITY) */ protected $id; ... greets, Oli On Feb 24, 8:13 pm, taidehuone taidehu...@gmail.com wrote: I'm no expert in any way but since I have working repositories I might as well drop a line or two on this. Personally I have never called the doctrine:generate:repositories task. I have created the repository files and entity files by hand so that the file structure looks like this. I don't know if this follows the best practices because I might be outdated on that, but it works with the latest master branch version of symfony 2. src/Warbler/AccountBundle/Entity/Account.php src/Warbler/AccountBundle/Entity/AccountRepository.php src/Warbler/AccountBundle/Entity/OrganizationAccount.php src/Warbler/AccountBundle/Entity/OrganizationAccountRepository.php My Entity definition starts like this: ?php namespace Warbler\AccountBundle\Entity; use Symfony\Component\Security\Core\User\AccountInterface; use Symfony\Component\Security\Core\User\AdvancedAccountInterface; /** * @orm:Entity(repositoryClass=Warbler\AccountBundle\Entity\AccountRepository) */ class Account implements AdvancedAccountInterface { } And my Repository definition starts like this: ?php namespace Warbler\AccountBundle\Entity; use Doctrine\ORM\EntityRepository; class AccountRepository extends EntityRepository { } -- 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
[symfony-users] Re: Generating repositories
Up ! This is quite blocking for me not to have the repositories. Can please someone point me to the right direction ? I really tried many and many configurations... Maybe I just missed the one that works. Thanks a lot, On 18 fév, 00:01, Lideln lid...@gmail.com wrote: Hi, I am trying to generate the repositories : php app/console doctrine:generate:repositoriesMainBundle But what I get is : SKIP no custom repository for Ratethestar\MainBundle\Entity\Entry SKIP no custom repository for Ratethestar\MainBundle\Entity\Member SKIP no custom repository for Ratethestar\MainBundle\Entity\Review I looked into the code, and the ClassMetadataInfo- customRepositoryClassName attribute is empty. What do I have to change for that attribute to be filled properly ? I tried to manually change my Entity class : namespace Ratethestar\MainBundle\Entity; use Symfony\Component\Security\Core\User\AccountInterface; /** * Ratethestar\MainBundle\Entity\Member * @Entity(repositoryClass=Ratethestar\MainBundle\Repository\Member) * @orm:Entity(repositoryClass=Ratethestar\MainBundle\Repository \Member) */ class Member implements AccountInterface Here is my config.yml : doctrine.orm: mappings: MainBundle: { type: yml } entity_managers: default: connection: default mappings: MainBundle: { type: annotation } (when using type: yml, it did not change anything). Then I got the error : [Doctrine\ORM\Mapping\MappingException] No identifier/primary key specified for Entity 'Ratethestar\MainBundle \Entity\Member' I do not feel like modifying my Entities by hand each time I generate them. Is there a way to fill all the info required bygenerate:repositories when generating my entities and then use the type: yml for thegenerate:repositories? Thank you very much ! -- 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
[symfony-users] Re: EntityChoiceField : two issues
Hi Christophe, On 23 fév, 18:22, stof s...@notk.org wrote: On Wed, 23 Feb 2011 09:08:33 -0800 (PST), Lideln lid...@gmail.com wrote: Hi Carlos, Thank you for the answer ! This is a good idea to use options to pass the EM, I will follow your advice ! Using an option is the good way to give the em to the form. This is how it has to be passed to the EntityChoiceField so just add it as a required option in your own form class. Nevertheless, it would be easier to be able to access the EM globaly, with an utility class or whatever (and this is not restricted to the em, but it would be great to be able to access the container from anywhere and not only the view). The container cannot be accessed from the view. What about $view-container ? The container will not be accessible globally as this is not its purpose. It is meant to inject dependencies in the services, not to give access to all services everywhere. an entity or a template should not have access to the container. I will wait to see if my two first bugs are fixed in the (hopefully upcoming) RC1 ! :) Thanks again, Regards -- Christophe | Stof -- 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
[symfony-users] Re: EntityChoiceField : two issues
Hi Carlos, Thank you for the answer ! This is a good idea to use options to pass the EM, I will follow your advice ! Nevertheless, it would be easier to be able to access the EM globaly, with an utility class or whatever (and this is not restricted to the em, but it would be great to be able to access the container from anywhere and not only the view). I will wait to see if my two first bugs are fixed in the (hopefully upcoming) RC1 ! :) Thanks again, On 21 fév, 12:32, Carlos Sánchez carloss...@gmail.com wrote: I've got no answer to your first question, it worked fine a couple of commits ago... it's continuosly changing. For the second point I pass the parameter in when creating the form in the controller $form = MyForm::create($this-get('form.context'), 'my_namet', array('em' = $this-get('doctrine.orm.entity_manager'))); and addOption/getOption in the form class class MyForm extends Form { public function configure() { $this-addOption('em'); -- might go in the constructor (not proved) $em = $this-getOption('em'); //... } } Hope it helps!! On Feb 20, 10:16 pm, Lideln lid...@gmail.com wrote: Hi, I'm using the EntityChoiceField, and I encountered two issues : 1) when modifying the querybuilder, the value in the html option tag is not the one corresponding to the label of the option tag 2) I only get one single option tag in my select, whereas I have multiple rows in my db table, even when specifying the setMaxResults() Here is the call : $this-add(new EntityChoiceField('nationalité', array( 'property_path' = 'nationality', 'em' = self::$oEM, 'class' = 'Ratethestar\\MainBundle\\Entity\ \Nationality', 'property' = 'label', 'query_builder' = function($repository) { return $repository-createQueryBuilder('n')-orderBy('n.label', 'ASC')-setMaxResults(100); } ))); Oh, last thing : how do you get the EM from a Form ? I had to create a static field and provide it with the EM before creating my form. Thank you all ! PS : still can't generate repositories :'( -- 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
[symfony-users] Re: DateField type error
I digged a bit and got those results : When using type = raw, and providing an associative array, it works ! (but not for validation) When using type = string, I have to modify PropertyPath.php in function readPropertyPath() : else { if (is_string($objectOrArray)) { list($iYear, $iMonth, $iDay) = explode('-', $objectOrArray); $objectOrArray = array('year' = $iYear, 'month' = $iMonth, 'day' = $iDay); } But I guess this is not the place to fix, it must be in the BirthdayField somewhere. Anyway in both cases (I couldn't get it work with the DateTime type), when submitting the form I get an array as value for this birthday field (which is normal : 3 select box), but this array is never translated and in the Date validator I get a null value for the field. Any help appreciated here :) Thx ! On 20 fév, 04:51, Dennis Jacobfeuerborn djacobfeuerb...@gmail.com wrote: Date and DateTime Fields exhibit some strange behavior for me as well as reported here:https://groups.google.com/d/msg/symfony-devs/ASuq1Q2T4gI/ZP-_na2kpJ0J Hopefully I'll find some time tomorrow to dig deeper into the actual cause of this. -- 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
[symfony-users] [Symfony2] EntityChoiceField : two issues
Hi, I'm using the EntityChoiceField, and I encountered two issues : 1) when modifying the querybuilder, the value in the html option tag is not the one corresponding to the label of the option tag 2) I only get one single option tag in my select, whereas I have multiple rows in my db table, even when specifying the setMaxResults() Here is the call : $this-add(new EntityChoiceField('nationalité', array( 'property_path' = 'nationality', 'em' = self::$oEM, 'class' = 'Ratethestar\\MainBundle\\Entity\ \Nationality', 'property' = 'label', 'query_builder' = function($repository) { return $repository-createQueryBuilder('n')- orderBy('n.label', 'ASC')-setMaxResults(100); } ))); Oh, last thing : how do you get the EM from a Form ? I had to create a static field and provide it with the EM before creating my form. Thank you all ! PS : still can't generate repositories :'( -- 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
[symfony-users] Re: [Symfony2] DateField type error
Hi Bernhard, Ok I'll try that, but in that case that does not explain why it complains when I use the type=string parameter ? Is there a fully functionnal example of the DateField and Date() validator thing ? On 18 fév, 14:22, Bernhard Schussek bschus...@gmail.com wrote: Hi Lideln, The @Date constraint checks for date strings with format -MM-DD. What you want is @AssertType(\DateTime). Maybe we have a naming issue here. Bernhard -- 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
[symfony-users] Re: symfony2 - access everything from Entity class
Thank you Christophe, I tried to generate the repositories before but it complained about nothing to do, therefore I worked on something else. I will try what you told me tonight. Thank you ! On 17 fév, 15:22, Christophe COEVOET s...@notk.org wrote: Le 16/02/2011 23:00, Lideln a crit : Hi ! I am experimenting the PR6, but I could not find how to access things from Entity just as you would do from Controller ($this- get('database_connection') or $this- get('doctrine.orm.entity_manager') and so on). It would be nice to place all static database queries inside the Entities. The right place for the queries is the EntityRepository, not the entity itself. Look at the Doctrine2 doc about custom repositories:http://www.doctrine-project.org/docs/orm/2.0/en/reference/working-wit... And also, I am willing to use my Member Entity as the Domain Object for the register page. Same here. Use your custom repository by implementing Symfony\Component\Security\Core\User\UserProviderInterface and use the Doctrine entity Provider as described here:http://docs.symfony-reloaded.org/master/guides/security/users.html#do... Regards -- Christophe | Stof -- 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
[symfony-users] [Symfony2] DateField type error
Hi there, I added a DateField to my form. $this-add(new DateField('dateBirth', array('years' = range(date('Y') - 100, date('Y') - 17; 1) If I do not specify the type (which is DateTime by default), I get this error when submitting : Expected argument of type string, object given (DateValidator.php line 29) My Domain Object : /** * @validation:Date() * @var date $dateBirth */ private $dateBirth; (ok, a workaround would be to not use validation, but that is lame ^^) 2) If I create my field with option type = 'string', I get this error : Fatal error: Call to a member function format() on a non-object in Doctrine\DBAL\Types\DateType.php on line 44 I'm totally lost with this DateField thing... (see my other post about the 'data' parameter with the default value). Please, any help somewhere ? Point me to some tutorial or documentation, and I will study it. But looking at the code, I humbly think it is a bug of the framework. What do you think ? Kind regards, -- 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
[symfony-users] [Symfony2] Generating repositories
Hi, I am trying to generate the repositories : php app/console doctrine:generate:repositories MainBundle But what I get is : SKIP no custom repository for Ratethestar\MainBundle\Entity\Entry SKIP no custom repository for Ratethestar\MainBundle\Entity\Member SKIP no custom repository for Ratethestar\MainBundle\Entity\Review I looked into the code, and the ClassMetadataInfo- customRepositoryClassName attribute is empty. What do I have to change for that attribute to be filled properly ? I tried to manually change my Entity class : namespace Ratethestar\MainBundle\Entity; use Symfony\Component\Security\Core\User\AccountInterface; /** * Ratethestar\MainBundle\Entity\Member * @Entity(repositoryClass=Ratethestar\MainBundle\Repository\Member) * @orm:Entity(repositoryClass=Ratethestar\MainBundle\Repository \Member) */ class Member implements AccountInterface Here is my config.yml : doctrine.orm: mappings: MainBundle: { type: yml } entity_managers: default: connection: default mappings: MainBundle: { type: annotation } (when using type: yml, it did not change anything). Then I got the error : [Doctrine\ORM\Mapping\MappingException] No identifier/primary key specified for Entity 'Ratethestar\MainBundle \Entity\Member' I do not feel like modifying my Entities by hand each time I generate them. Is there a way to fill all the info required by generate:repositories when generating my entities and then use the type: yml for the generate:repositories ? Thank you very much ! -- 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
[symfony-users] symfony2 - access everything from Entity class
Hi ! I am experimenting the PR6, but I could not find how to access things from Entity just as you would do from Controller ($this- get('database_connection') or $this- get('doctrine.orm.entity_manager') and so on). It would be nice to place all static database queries inside the Entities. And also, I am willing to use my Member Entity as the Domain Object for the register page. Thank you all ! -- 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
[symfony-users] Re: Forms and validation
Hi ! I fixed the issue by removing my lame ctor and passing the name parameter to the create() factory instead as advised. Thank you all ! On 16 fév, 10:51, Bernhard Schussek bschus...@gmail.com wrote: Oops, parentheses I mean. /** @validation:NotNull */ and /** @validation:NotNull() */ both are valid. Bernhard -- 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
[symfony-users] Re: Form validation
On 16 fév, 00:02, Christophe COEVOET s...@notk.org wrote: Le 15/02/2011 23:57, Lideln a crit : Since I cannot add new answers to the topic I created earlier (why that ?), I create a new one here with additionnal info. As I said, I followed the official tutorial to create a RegisterForm and using it to register new members. But I got stuck at the validation, because I got the error : The option validator is required for validating Here is my code, please can you tell me what I did wrong ? [config.yml] app.config: error_handler: null validation: { enabled: true, annotations: true } [controller] $oRequest = new RegisterRequest(); $oForm = RegisterForm::create($this-get('form.context')); You need to provide the name of the form here as a second argument. The doc of the master has been fixed for this point. Regards -- Christophe | Stof Hi Christophe, Thanks for the answer ! Yes I have been told that (although my method seems to work as well). Do you have any tips regarding the error I got ? (I'm sorry I created another topic, if an admin car move it please ?) -- 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
[symfony-users] Re: Forms and validation
Hi, I did not understand the parent thing ? Is there something wrong with my code ? I hope so, otherwise I would not understand why I got this error :-/ On 16 fév, 00:27, Bernhard Schussek bschus...@gmail.com wrote: Correct syntax for annotation-validators is to use parents in the end: email(), NotBlank()... This is not true. You can leave away the parents just as well. Bernhard -- 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
[symfony-users] Re: Forms and validation
On 16 fév, 00:27, Bernhard Schussek bschus...@gmail.com wrote: Correct syntax for annotation-validators is to use parents in the end: email(), NotBlank()... This is not true. You can leave away the parents just as well. Bernhard Sorry what do you guys mean by parents ? Is there something wrong with my code ? But if there is not, why did I get that strange error ? -- 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
[symfony-users] [SF2] Forms and validation
Hi there, I have been experimenting with the PR6 lately. Now I'm stuck with the forms and validation, and kinda need some tips. I followed the official tutorial, and I succeeded in creating a form and displaying it (but two minor things : I did not see an EmailField in the code, and I could not find a way to specify the label). Though, when it came to validation, I created a RegisterRequest with annotations for validation, but when submitting the form, I got this error : The option validator is required for validating Please note that I activated the validation in the config.yml Thank you all (if you have a link to more up to date tutorials, I would love to have it, thank you :) ) Lideln -- 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
[symfony-users] Re: Forms and validation
Hi Nikita, Yes I already discovered the missing name by myself and added a __construct() in my RegisterForm class, that is calling parent::__construct('register') and it works fine. But the validators don't work, I got this strange error as if a Validation instance does not exist in the context ($this- get('form.context') ??). Maybe I should make my RegisterRequest class extend some Validation class ? Or am I missing some config.yml entries ? I can give you my code this evening, I'm at the office right now. Any help would be greatly appreciated (I have several questions regarding sf2 but form validation will be enough for now ^^) Kind regards, Lideln On 15 fév, 17:23, Nikita Korotaev websir...@gmail.com wrote: There is no such thing like EmailField at the moment, I don't know why it's in docs. You should use textField and set Email validator instead. The form creation seem to be valid in docs, only missing the name parameter. Check this topic for more information:https://groups.google.com/forum/#!topic/symfony-users/ylWVP5KsAEw Regards, Nikita -- 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
[symfony-users] Re: Forms and validation
Hi Nikita, Thanks for the answer. I had already discovered the form name parameter. Only I fixed it by creating a ctor in my form and calling parent::__construct('register'). The topic you kindly gave me did not help. I still have the The option validator is required for validating error. Just as if the validator was not existing in the context ($oForm = RegisterForm::create($this-get('form.context'));) Here is my code, is there anything wrong with it ? [controller] $oRequest = new RegisterRequest(); $oForm = RegisterForm::create($this-get('form.context')); $oForm-bind($this-get('request'), $oRequest); if ($oForm-isValid()) { echo 'Form valid !br /'; } [form] class RegisterForm extends Form { public function __construct() { parent::__construct('register'); } protected function configure() { $this-add(new TextField('email', array('max_length' = 100))); $this-add(new TextField('pseudo', array('max_length' = 18))); $this-add(new PasswordField('password', array('max_length' = 45))); } } [domain object] class RegisterRequest { /** * @validation:Email * @validation:MaxLength(100) * @validation:NotBlank */ protected $email; /** * @validation:MaxLength(18) * @validation:NotBlank */ protected $pseudo; /** * @validation:MaxLength(40) * @validation:NotBlank */ protected $password; // getters and setters } [config] app.config: error_handler: null validation:{ enabled: true, annotations: true } On 15 fév, 17:23, Nikita Korotaev websir...@gmail.com wrote: There is no such thing like EmailField at the moment, I don't know why it's in docs. You should use textField and set Email validator instead. The form creation seem to be valid in docs, only missing the name parameter. Check this topic for more information:https://groups.google.com/forum/#!topic/symfony-users/ylWVP5KsAEw Regards, Nikita -- 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
[symfony-users] Form validation
Since I cannot add new answers to the topic I created earlier (why that ?), I create a new one here with additionnal info. As I said, I followed the official tutorial to create a RegisterForm and using it to register new members. But I got stuck at the validation, because I got the error : The option validator is required for validating Here is my code, please can you tell me what I did wrong ? [config.yml] app.config: error_handler: null validation:{ enabled: true, annotations: true } [controller] $oRequest = new RegisterRequest(); $oForm = RegisterForm::create($this-get('form.context')); $oForm-bind($this-get('request'), $oRequest); if ($oForm-isValid()) { echo 'Form valid !br /'; } [form] class RegisterForm extends Form { public function __construct() { parent::__construct('register'); } protected function configure() { $this-add(new TextField('email', array('max_length' = 100))); $this-add(new TextField('pseudo', array('max_length' = 18))); $this-add(new PasswordField('password', array('max_length' = 45))); } } [domain object] class RegisterRequest { /** * @validation:Email * @validation:MaxLength(100) * @validation:NotBlank */ protected $email; /** * @validation:MaxLength(18) * @validation:NotBlank */ protected $pseudo; /** * @validation:MaxLength(40) * @validation:NotBlank */ protected $password; // getters and setters } Thank you all, any help is welcome ! -- 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
[symfony-users] Re: [SF2] Tiny thoughts
Hi Pablo, Thanks for your answer ! I understand that point of view, and I agree with it too :) I was just thinking of convenient ways of doing things, shortcuts if you want. For now I'll continue to learn Symfony2, but after that I'll do as you advised me to : extend the classes in order to speed development a bit with lots of shortcuts. Thank you again ! Renaud On 1 déc, 00:48, Pablo Díez pablo...@gmail.com wrote: The answer for the three points is: that's the default way, but like one of the principles of Symfony2 is to be flexible, you can overwrite that behaviors with your own classes extending the Symfony2 classes and do it like you want. Although don't worry, really the default way is better than oneself think in the beginning! Pablo On Mon, Nov 29, 2010 at 7:22 PM, Lideln lid...@gmail.com wrote: Hi there, I just read the entire Symfony 2 quick tour. I found many useful and smart things, which are great ! But I also wondered about a few (tiny) things, that are more about ease of use. Hope I get an answer here :) 1) I'm sorry that we lost the ability to return nothing in the action (which would default to a specific template). Instead now, we have to write $this-render('HelloBundle:Hello:index', array('name' = $name));, which is long and useless. I think the SF1.4 way was quicker. (but I am definitely fond of the arguments-like new way of dealing parameters :) ) 2) Can't we define layouts in view.yml anymore ? Do we have to use ? php $view-extend('HelloBundle::layout') ? in every single view ? 3) Is there a shortcut like $view-render('hello') (that would default the namespace to the current one, if not specified) ? These are just tiny thoughts (and other ones that were even tinier so I did not bother to write them), but as much as I find the SF2 features awesome, I find it a bit more complex to use (but maybe it's also a question of habit). Thank you for your answers :) A humble SF user. -- 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.comsymfony-users%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -- *Pablo Díez | @pablodip* MondonGO Lead Developerhttp://mondongo.es -- 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
[symfony-users] Re: [SF2] Tiny thoughts
Hi Fabien, Thank you for your answers. You are right that I don't know of all the tickets that were opened for symfony1, and I should keep that in mind. Regarding Symfony2, I was just giving my fresh (and, should I say again, humble) feedback of a new user of Symfony2. It's true that in Symfony2 some things are longer to write than before, but that is just detail compared to the great new features it provides. I won't argue with you about that, because as you told me, this is for the need of flexibility (although I still think that some shortcuts are possible and would relieve developpers a bit). I'm retrieving information all over the web in order to widen my knownledge of Symfony2 (although I know it will change slightly) and practise, as you advised me to, on a small project. Just like so many people, I can't wait to get the stable release at last ! I'm glad I can thank you in person for all the amazing work you did with Symfony (among other things). Thank you ! It's true that my small feedback was a point of detail compared to the complexity of the framework. Thanks from Paris, Renaud On 1 déc, 07:52, Fabien Potencier fabien.potenc...@symfony- project.com wrote: On 11/29/10 7:22 PM, Lideln wrote: Hi there, I just read the entire Symfony 2 quick tour. I found many useful and smart things, which are great ! But I also wondered about a few (tiny) things, that are more about ease of use. Hope I get an answer here :) The answer: Explicit is always better than implicit. In symfony1, we have all kind of things that happen automagically. You know them and you know how they, but a newcomer can just scratch its head to understand what's going on. Futhermore, when you want to escape from the default behavior, it's a bit more complex; also because you now have a different way of doing things. Symfony2 basically solves these problems. 1) I'm sorry that we lost the ability to return nothing in the action (which would default to a specific template). Instead now, we have to write $this-render('HelloBundle:Hello:index', array('name' = $name));, which is long and useless. I think the SF1.4 way was quicker. (but I am definitely fond of the arguments-like new way of dealing parameters :) ) Probably quicker to write but definitely less flexible. In Symfony2, there is only one way, and the one true way is as flexible as you might need. 2) Can't we define layouts in view.yml anymore ? Do we have to use ? php $view-extend('HelloBundle::layout') ? in every single view ? The layout belongs to the template. So, it's much better now. Also, just have a look at all the problems we have we the default layout in symfony1 (and all the related tickets we just cannot solve easily). As before, there is now only one way to define a layout. It is much easier to learn and to master. 3) Is there a shortcut like $view-render('hello') (that would default the namespace to the current one, if not specified) ? Again, in symfony1, the fact that a partial for instance tries to automatically determines the context falls apart pretty quickly (just try that with a partial used in two different modules). These are just tiny thoughts (and other ones that were even tinier so I did not bother to write them), but as much as I find the SF2 features awesome, I find it a bit more complex to use (but maybe it's also a question of habit). When learning Symfony2, you need to put symfony1 aside and more importantly, you need to use Symfony2 for a small project to understand all the benefits of the new approach. Thanks for the feedback, Fabien Thank you for your answers :) A humble SF user. -- 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
[symfony-users] [SF2] Tiny thoughts
Hi there, I just read the entire Symfony 2 quick tour. I found many useful and smart things, which are great ! But I also wondered about a few (tiny) things, that are more about ease of use. Hope I get an answer here :) 1) I'm sorry that we lost the ability to return nothing in the action (which would default to a specific template). Instead now, we have to write $this-render('HelloBundle:Hello:index', array('name' = $name));, which is long and useless. I think the SF1.4 way was quicker. (but I am definitely fond of the arguments-like new way of dealing parameters :) ) 2) Can't we define layouts in view.yml anymore ? Do we have to use ? php $view-extend('HelloBundle::layout') ? in every single view ? 3) Is there a shortcut like $view-render('hello') (that would default the namespace to the current one, if not specified) ? These are just tiny thoughts (and other ones that were even tinier so I did not bother to write them), but as much as I find the SF2 features awesome, I find it a bit more complex to use (but maybe it's also a question of habit). Thank you for your answers :) A humble SF user. -- 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