Re: [symfony-users] [symfony 1.4] Retrieving Value from FormField
You have $form-getValue('fieldname') will give you the value for a certain field. $values = $form-getValues() will dump an array of all the form values with the field name as the array key. On Fri, Mar 4, 2011 at 4:30 AM, Alex Pilon alex.pi...@gmail.com wrote: The way you described is using the arrayaccess interface which I believe is something that symfony takes great advantage of. I would say that is a fine way to do it. 2011/3/3 Sebastian Göttschkes sebastian.goettsch...@googlemail.com Hi, I'm currently not using FormWidgets as I got some Javascript working and some special changes in the form. I now need to get the value of a FormField, which can be either the value stored in the database (when the edit-page is viewed without a POST) or the (wrong) data submitted by the user. I understand that I can use $form['fieldName']-getValue(), but as symfony is almost always avoiding arrays, I'm curious if this is the correct way. I was looking for something like $form-getField('fieldName')-getValue(). Thanks for your help in clearing this issue. Regards, Sebastian -- 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 -- 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
Re: [symfony-users] Executing some code before every action of every controller
Hi, If you are under symfony 1.x and not symfony2, then you need to check about filters and the filter chain. You will be able in a config file to declare your filter class anywhere inside the filter chain (including just before the controller is called). Allowing you to execute whatever code you want before any controller ever. On Tue, Mar 1, 2011 at 4:44 PM, elitalon elita...@inventiaplus.com wrote: Hi, I am developing an application that has to record a log in the background for each action the user executes. I know Symfony comes with a preExecute callback, but I would have to define in in every controller. Is it possible to define it in some higher level in order to write the code once? I know that you can override AppController in CakePHP, but I'm not sure if Symfony has a similar or even better mechanism. 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 -- 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
Re: [symfony-users] [Symfony2] - Dynamic Subforms
I haven't played enough with symfony2 to get you a definitive answer, but here are some ways you could look first: from my understanding, the form framework in sf2 stayed mostly the same as the sf 1.4 form framework. In this case you could have a look at the code of this plugin: sfDoctrineDynamicFormRelationsPlugin which does exactly what you're trying to do, though on the previous version of symfony. Maybe you can find something there On Wed, Feb 23, 2011 at 4:55 PM, jdewit jorisdewitblackbe...@gmail.comwrote: I'm trying to implement subforms to allow for adding/removing multiple instances of a oneToMany relation. I have it working for a single instance but how do I go about being able to process multiple fields that are added with jquery? I'm used to doing this using array notation so some help with the Symfony2 way would be much appreciated. Here's my code so far: ?php namespace Sensio\MsmBundle\Form; use Symfony\Component\Form\Form; use Symfony\Component\Form\TextField; use Sensio\MsmBundle\Form\ServiceForm; class EstimateForm extends Form { public function configure() { $this-addOption('em'); $em = $this-getOption('em'); $this-setDataClass(Sensio\MsmBundle\Entity\Estimate); $serviceRepository = $em-getRepository('Sensio\MsmBundle\Entity\Service'); $this-add(new TextField('number')); $this-add(new TextField('date')); //embed services form $this-add(ServiceForm::create($this-getContext(), 'services', array('em' = $em))); } } //form.html.twig--- form id=estimateForm action=# method=post {{ form_enctype(estimateForm) }} {{ form_field(form.number) }} {{ form_field(form.date) }} {{ form_field(form.services) }} {{ form_hidden(form) }} /form 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 -- 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
Re: [symfony-users] Re: Doctrine version classes
Yikes! Thank you, as we're only in dev right now there's no APC installed but it is definitely on the list for our prod environment so we'll keep that in mind. On Tue, Feb 22, 2011 at 4:28 PM, Georg geor...@have2.com wrote: Be careful with the generateFiles option. This regenerates the files on *each* usage of the model class (see the change time of the generated file after a usage). And this creates serious troubles with APC, because APC always re-caches the file, and this leads to have cache fragmentation, and possibly segmentation faults. See http://www.doctrine-project.org/jira/browse/DC-974 If you experience this, consider setting apc.file_md5 to true. Am 21.02.2011 08:02, schrieb Sebastien Armand [Pink]: Found the reason behind this issue though I don't have any very good solution for now, but in case someone else gets this kind of problem, here it goes: First of all you need the 'generateFiles' option to be true when you define your versionable models. Once this is done, you will have a new 'ModelVersion' class file. The 'BaseModelVersion' class only defines columns, not the relations. Copy pasting the relations defined in the 'BaseModel' class into 'ModelVersion::setTableDefinition()' will do the job and now your version class has its relations defined too. However if you ever create a query with the 'Model' class, since it has the versionable behavior, it will define the 'ModelVersion' table altogether. (Define here means in memory, for Doctrine to be able to work with those table). This definition will be made through the behavior and not through the files that we just created. Since Doctrine makes use of some caching techniques, it won't redefine the 'ModelVersion' when we try to use it. Therefore the relations won't be set up. Whenever we want to use those version classes in a DQL query with their related components, we need to redefine the table and erase the version Doctrine could previously have. For this, just create an object and use the setTableDefinition method: $object = new ModelVersion(); $object-setTableDefinition(); From now on, the Version table is defined with the relations set. Looking at the code for the Versionable behavior I found a 'generateRelations' option which is already set to 'true' by default. However it is never used and doesn't link to anything. I guess there was a plan to implement such possibilities but for whatever reason it didn't happen. Since Doctrine's focus is now on Doctrine 2 and no longer on 1.2 I don't see any change happening here so I'll keep using the workaround I found. Hope this might be of some help to other people. On Thu, Jan 6, 2011 at 6:34 PM, Sebastien Armand [Pink] khe...@gmail.com mailto:khe...@gmail.com wrote: Now the query I was trying earlier is working. However, I need to also query a few other tables that are relations on my object, but the relations are not set as part as the Version object. I did override the setUp method of the version objects in order to benefit from the relations directly. So far so good, in my action I can start a query like this: $q = Doctrine_Query::create() -from('ObjectVersion ov') -leftJoin('ov.Address a') This works just fine and I can create the query I want BUT BUT only as long as I create the query from the action... If I try to create that query from a xxxTable class for example, then the Address relation is not recognized anymore by Doctrine. Any ideas on this? On Wed, Dec 29, 2010 at 4:29 PM, Sebastien Armand [Pink] khe...@gmail.com mailto:khe...@gmail.com wrote: 1- When using the Doctrine plugin for symfony, and the versionable behavior, the version classes don't seem to be generated like specified in the Doctrine documentation. However the version classes for the forms are generated. Is there a way to generate the model classes too? 2- Now more importantly, I want, through the version table, to get a snapshot of what the main table was at a given time T. So I'm trying to select only records that satisfy updated_at T, but among those records I might have multiple versions of the same record and I only want the one that was the most up to date at time T. In SQL I can make a subquery on the same table to get the maximum updated_at value before T or the maximum version number with updated_at T. The same request in DQL does not seem to work. If I try: $q = Doctrine_Core::getTable('ObjectVersion')-createQuery('fv1') -where('fv1.updated_at = (select max(fv2.updated_at) from ObjectVersion fv2 where fv1.id http://fv1.id = fv2.id http://fv2.id and fv2.updated_at
[symfony-users] Re: Doctrine version classes
Found the reason behind this issue though I don't have any very good solution for now, but in case someone else gets this kind of problem, here it goes: First of all you need the 'generateFiles' option to be true when you define your versionable models. Once this is done, you will have a new 'ModelVersion' class file. The 'BaseModelVersion' class only defines columns, not the relations. Copy pasting the relations defined in the 'BaseModel' class into 'ModelVersion::setTableDefinition()' will do the job and now your version class has its relations defined too. However if you ever create a query with the 'Model' class, since it has the versionable behavior, it will define the 'ModelVersion' table altogether. (Define here means in memory, for Doctrine to be able to work with those table). This definition will be made through the behavior and not through the files that we just created. Since Doctrine makes use of some caching techniques, it won't redefine the 'ModelVersion' when we try to use it. Therefore the relations won't be set up. Whenever we want to use those version classes in a DQL query with their related components, we need to redefine the table and erase the version Doctrine could previously have. For this, just create an object and use the setTableDefinition method: $object = new ModelVersion(); $object-setTableDefinition(); From now on, the Version table is defined with the relations set. Looking at the code for the Versionable behavior I found a 'generateRelations' option which is already set to 'true' by default. However it is never used and doesn't link to anything. I guess there was a plan to implement such possibilities but for whatever reason it didn't happen. Since Doctrine's focus is now on Doctrine 2 and no longer on 1.2 I don't see any change happening here so I'll keep using the workaround I found. Hope this might be of some help to other people. On Thu, Jan 6, 2011 at 6:34 PM, Sebastien Armand [Pink] khe...@gmail.comwrote: Now the query I was trying earlier is working. However, I need to also query a few other tables that are relations on my object, but the relations are not set as part as the Version object. I did override the setUp method of the version objects in order to benefit from the relations directly. So far so good, in my action I can start a query like this: $q = Doctrine_Query::create() -from('ObjectVersion ov') -leftJoin('ov.Address a') This works just fine and I can create the query I want BUT BUT only as long as I create the query from the action... If I try to create that query from a xxxTable class for example, then the Address relation is not recognized anymore by Doctrine. Any ideas on this? On Wed, Dec 29, 2010 at 4:29 PM, Sebastien Armand [Pink] khe...@gmail.com wrote: 1- When using the Doctrine plugin for symfony, and the versionable behavior, the version classes don't seem to be generated like specified in the Doctrine documentation. However the version classes for the forms are generated. Is there a way to generate the model classes too? 2- Now more importantly, I want, through the version table, to get a snapshot of what the main table was at a given time T. So I'm trying to select only records that satisfy updated_at T, but among those records I might have multiple versions of the same record and I only want the one that was the most up to date at time T. In SQL I can make a subquery on the same table to get the maximum updated_at value before T or the maximum version number with updated_at T. The same request in DQL does not seem to work. If I try: $q = Doctrine_Core::getTable('ObjectVersion')-createQuery('fv1') -where('fv1.updated_at = (select max(fv2.updated_at) from ObjectVersion fv2 where fv1.id = fv2.id and fv2.updated_at ?)','2010-12-29 06:40:59'); I get an exception Couldn't find class fv2. However if I output the DQL from the query, what I get corresponds perfectly to the SQL I could use directly in the DB... Any ideas are welcome! Thanks, Khepin -- 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: Doctrine version classes
Now the query I was trying earlier is working. However, I need to also query a few other tables that are relations on my object, but the relations are not set as part as the Version object. I did override the setUp method of the version objects in order to benefit from the relations directly. So far so good, in my action I can start a query like this: $q = Doctrine_Query::create() -from('ObjectVersion ov') -leftJoin('ov.Address a') This works just fine and I can create the query I want BUT BUT only as long as I create the query from the action... If I try to create that query from a xxxTable class for example, then the Address relation is not recognized anymore by Doctrine. Any ideas on this? On Wed, Dec 29, 2010 at 4:29 PM, Sebastien Armand [Pink] khe...@gmail.comwrote: 1- When using the Doctrine plugin for symfony, and the versionable behavior, the version classes don't seem to be generated like specified in the Doctrine documentation. However the version classes for the forms are generated. Is there a way to generate the model classes too? 2- Now more importantly, I want, through the version table, to get a snapshot of what the main table was at a given time T. So I'm trying to select only records that satisfy updated_at T, but among those records I might have multiple versions of the same record and I only want the one that was the most up to date at time T. In SQL I can make a subquery on the same table to get the maximum updated_at value before T or the maximum version number with updated_at T. The same request in DQL does not seem to work. If I try: $q = Doctrine_Core::getTable('ObjectVersion')-createQuery('fv1') -where('fv1.updated_at = (select max(fv2.updated_at) from ObjectVersion fv2 where fv1.id = fv2.id and fv2.updated_at ?)','2010-12-29 06:40:59'); I get an exception Couldn't find class fv2. However if I output the DQL from the query, what I get corresponds perfectly to the SQL I could use directly in the DB... Any ideas are welcome! Thanks, Khepin -- 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
Re: [symfony-users] question about filter forms and multiple select widgets
I've got a blog post on how to use the form filters here: http://sf.khepin.com/2010/10/symfony-filter-forms-and-related-tables/ in the part where I explain how to use filters from related tables, I explain how to override the generation of the query part for a certain field or relation in order to avoid that issue you're having. If not enough, post again here so I'll detail. On Thu, Nov 18, 2010 at 11:36 PM, Stan McFarland sfmc...@gmail.com wrote: Hi, I've successfully created a filter form for my frontend app, but want to allow the user to select multiple values for a given attribute. After changing the widget to allow multiple values, I can select a single value from the select widget, and the SQL appears to be generated correctly: Before: (r.status_id = ?) - (1) After: (r.status_id in ?) - (1) but if I select multiple values I get an error Invalid parameter number: number of bound variables does not match number of tokens. I'd cut and paste the error log except I'm behind a firewall with no way to cut and paste. Is what I'm wanting to do possible? Thanks, Stan -- 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 -- 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
Re: [symfony-users] sorting with formfilter?
$query-addSort('mysort_columnt asc'); On Sun, Nov 7, 2010 at 11:05 PM, Stan McFarland sfmc...@gmail.com wrote: Hi, Symfony newbie here. I needed to add a form filter capability to my frontend app, which I managed to do with the bind(), getQuery() and execute() methods, but my question is: can I add additional SQL-type criteria (such as order by) to the query generated by the formfilter methods, and if so, how? Thanks very much, Stan -- 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 -- 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] I18N: separate country and language?
Hi everyone, The app we're working on will need to be I18N, and it will need this under different conditions: - The app may be installed for clients in different countries (one install per client) - In one country they might need multiple languages (multicultural teams) However let's say that I am showing a Contract in Japan, I want to use the correct number format for Yen, no matter that my user browses my contract page in english or in japanese. My guess is that no such thing exists out of the box in Symfony and that a solution could be to have a 'default_culture' setting defined for the app and write my own helper for format_number that would force this default culture rather than use the user one. Also not sure how to deal with things when we start having on the same install contracts based on different currencies that should be shown with a number format linked to the currency rather than to the user's culture and language. -- 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
Re: [symfony-users] 1 action , 2 templates
Huh If it's only a minor difference in the templates, you probably don't really need 2 templates and could just pass a variable to the template so that from there you know how you should display it... On Thu, Nov 4, 2010 at 4:38 AM, Alex Pilon alex.pi...@gmail.com wrote: I think both ways are fine.. On Wed, Nov 3, 2010 at 16:33, Martin Ibarra Cervantes ibarra.cervan...@gmail.com wrote: you can use partitials for the view and in the acction pass the myvar include_partitial('name', array('myvar'=$myvar)); On Wed, Nov 3, 2010 at 1:29 PM, Parijat Kalia kaliapari...@gmail.com wrote: Hey guys, I have 2 very identical templates which have only a minor difference to them. Their action is exactly the same. So instead of retyping code or wasting precious space (LOL), here is what my genius conjours: private function privateAction() { // do some amazing coding } public function executeMyAction1() { $this-privateAction(); } public function executeMyAction2() { $this-privateAction(); } So basically, I redefined the common action as a private action. Is this a fine strategy? Or do we have a better recommended strategy! -- 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 -- 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 -- 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.comsymfony-users%2bunsubscr...@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
Re: [symfony-users] Re: symfony sans base de donnée - symfony without database
A thing you could take a look at is the mysql CSV storage engine. Going through mysql will give you all the power of SQL manipulations and you'll keep a flat csv file to store all your data that you can access in any other standard ways. Another option that might be interesting for you is to take a look at the symfony yml component and see what it can do for you. Last: php itself has some functions to use csv files directly but I don't know much about that! 2010/10/27 pmo philippe.mo...@gmail.com je pensais qu'au lieu d'utiliser des base de données, on pouvait utiliser un fichier qui serait formaté tel une base de donnée suivant un format qu'on pourrait spécifier quelque part. Mais, à priori, il faut simplement gérer soit même ses fichiers sur lesquels on veut faire des modifications. par exemple : je voudrais modifier le fichier /etc/passwd, au lieu d'initialiser une bdd avec une table passwd contenant les champs suivant : user - passwd - uid - gid - nom_user - home - bash on pourrait simplement dire que les données se trouvent dans un fichier formaté suivant des critères précis (séparation champ = : ...)et ensuite directement faire des modifications dans ce fichier comme on le ferai dans une bdd (avec toutes les méthodes déjà existantes pour lister / editer les enregistrements). Sais tu s'il existe des fonction symfony pour la gestion des fichiers ou faut il utiliser celles de php ? cdt, philippe On 24 oct, 15:36, Jérémie jeremie.symf...@gmail.com wrote: Alors, je ne suis pas sûr de bien comprendre ta requête, mais je ne vois pas ce qui t'empêche d'écrire toi même dans ces fichiers. l'option sans database dans settings existe bien, mais empèche simplement l'utilisation d'une base de donnée, mais comment faire pour lui dire d'utiliser des fichiers plat ? Je ne crois pas que tu puisses lui dire spécifiquement d'utiliser tel ou tel fichier. Mais comme je le disais au dessus, je vois pas pourquoi tu ne pourrais pas, toi même, lire/écrire ces fichiers. Tu peux créer tes méthodes, surcharger celles de symfony... À partir de là, tu as une marge de manœuvre relativement large :) Jérémie -- 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 -- 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] Accessor behavior
I have a trouble with my Doctrine generated classes accessors. It seems that the accessors don't behave the same whether a leftJoin has been previously performed or not. I understand that the idea is to avoid loading the data from DB if a join was performed, but in case there is nothing to join, the outside behavior of the accessor is not the same depending whether a join has been performed or not. This means that if in my template I want to echo: $book-getCoverArtist()-getName(); If there was no leftJoin performed on the Artist table, it's always successful. If I earlier did join the artist table in my request and I have a product for which we don't know any cover artist in the database, I'll get an error because I'm trying to use the getName() method on a non-object. Shouldn't the accessor method behave the same in both cases? Is there a way to overcome this error without re-writing all my accessors to change their return value in case nothing is returned? -- 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
Re: [symfony-users] Re: Having a web layer for the model
Bunch of nice ideas here! Gotta find how to make my own sauce now! On Thu, Oct 7, 2010 at 9:40 PM, Bernhard Schussek bschus...@gmail.comwrote: I rather prefer to compose than to subclass here. class ProductView { public function __construct(Product $product) { $this-product = $product; } public function setSelected($selected)... public function getUrl()... etc. } 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.comsymfony-users%2bunsubscr...@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
[symfony-users] Organizing modules
Hi everyone, I'm faced with the current issue: the number of modules that I have is constantly growing! So is the number of model classes etc... For model classes, Doctrine provides the notion of packages that I can use to group some classes together. So this is not a problem. When it comes to application modules though, there doesn't seem to be a way to do the same thing. In the same vein, is there a way to split the routing.yml file of an application per module or something equivalent? Regards, Seb -- 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
Re: [symfony-users] Re: Having a web layer for the model
It does indeed! Thanks On Thu, Oct 7, 2010 at 12:37 AM, Richtermeister nex...@gmail.com wrote: Hey Sebastien, your intuition is right, those things don't belong in the model, as they differ from application to application. There are easy ways to have the best of both worlds though. First, links to, say, a product I find pretty simple: link_to($product, product_show, $product); However, if they do get more complex, I just add a view helper: link_to_product($product, optional title here); that encapsulates the logic for the given application. With regards to cache, you can either add a custom CacheManager class to house that code: CacheManager::clearProductCache($product); or you could put those methods into the application configuration and then call sfContext::getInstance() - getConfiguration() - clearProductCache($product); Make sense? Daniel On Oct 5, 9:24 pm, Sebastien Armand [Pink] khe...@gmail.com wrote: Most of the times in symfony applications, we'll have a model let's say it's 'Product' and then many interactions that I don't think belong to the model part of the application still would be really convenient if you could write them as $myModel-doThis() The kind of interaction I'm thinking about are more 'application' level. For example I'll usually have a link to a page where this product is displayed, and instead of having to write the url_for ('product_route', $myProduct), it seems to me much more natural if I could write something like $myProduct-getUrl(). Same thing for removing bits of cache related to this product, it seems correct in a way to write $myProduct-removeCachedElements(); or something like this. However those interactions as I see them don't belong to the model, they are much more linked with a higher presentational or web level of interaction. Just wondering how other people do things this way or not? -- 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 -- 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] Having a web layer for the model
Most of the times in symfony applications, we'll have a model let's say it's 'Product' and then many interactions that I don't think belong to the model part of the application still would be really convenient if you could write them as $myModel-doThis() The kind of interaction I'm thinking about are more 'application' level. For example I'll usually have a link to a page where this product is displayed, and instead of having to write the url_for ('product_route', $myProduct), it seems to me much more natural if I could write something like $myProduct-getUrl(). Same thing for removing bits of cache related to this product, it seems correct in a way to write $myProduct-removeCachedElements(); or something like this. However those interactions as I see them don't belong to the model, they are much more linked with a higher presentational or web level of interaction. Just wondering how other people do things this way or not? -- 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] Encrypting symfony project
Well I bet this is not a topic that's gonna be immensely popular but it's not like I have a choice! So I need to encrypt the software we are currently building with symfony before deploying it to some clients. I don't have any knowledge of php encryption since I pretty much always thought I'd never need that, however it seems that encrypting symfony raises some issues related to the way symfony cache is made (some php classes need to be read to create the cache or the cache might contain non-encrypted classes that will not be usable alongside the encrypted ones, I'm not sure what the issue actually is). Any previous experience or knowledge of these issues would be appreciated. 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
Re: [symfony-users] A bug in the Web debug toolbar notification?
Your crud generate module never sends a reply directly from the create and update actions. You are redirected either to the edit action or to the show action if you generated a module with the show option on. So the answer you send to the browser from inside create is only a http header with the location set to the url for the edit or show action. Then the debug toolbar that you see is the one from that second action. Everything can still be seen in the log though if you need it. On Thu, Sep 16, 2010 at 6:07 AM, Alan Bem alan@gmail.com wrote: Do you redirect? 2010/9/15 Jorge Luis betancourt.jo...@gmail.com Hi: It's normal that when we send an email from an action that don't have any associated template there is no notification of this in the Web debug toolbar? I'm sending a confirmation email from a create action (from a CRUD generated module) but i don't get any email icon on the Web debug toolbar, but if i send the email from the new action (that has a newSuccess.php template) the notification system works as a charm!. Is this normal? Greetings! -- 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 -- 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 -- 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
Re: [symfony-users] [symfony1.4] not sure how to make parent-child category structure in doctrine schema
I've had the same issue recently and decided NOT to go with nested set. Nested set is a great tool if you really have hierarchical data that should be represented by a tree of unknown depth and need to input new data anywhere in the tree. In my case, and it seems true in your case too, I was sure not to go over 2 levels. My elements are either parents or children, but you cannot be children category of a parent one, and at the same time still have children categories. In that case with only 2 levels, I found faster and more easy to have something like: Category: columns: name: text parent_id:integer relations: Parent: class:Category local: parent_id foreign: id foreignAlias: Children If you know your structure and data will not (or very rarely) change and if you do not need a big depth, I find this solution way more convenient than using the nested set. Those are my 2cents on this topic ;-) use them if you will! On Mon, Sep 6, 2010 at 2:33 PM, Christopher Schnell christopher.schn...@mda.ch wrote: That’s right, Nested Set is the way to go. Both Propel and Doctrine support them. Regards, Christopher. *Von:* symfony-users@googlegroups.com [mailto: symfony-us...@googlegroups.com] *Im Auftrag von *Arnold Ispan *Gesendet:* Sonntag, 5. September 2010 21:31 *An:* symfony-users@googlegroups.com *Betreff:* Re: [symfony-users] [symfony1.4] not sure how to make parent-child category structure in doctrine schema Hello, Why don't use nested sets to represent this structure? On Sun, Sep 5, 2010 at 9:39 PM, ryr ryr1...@gmail.com wrote: Hello, I want to make a two-tier structure of the categories in which each item is either a parent of, or relate to one of the parents. Example structure: Category 1 - Subcategory 1 - Subcategory 2 - Subcategory 3 Category 2 Category 3 - Subcategory 4 - Subcategory 5 Category 4 How to implement this in config/doctrine/schema.yml? -- 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 -- 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 -- 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 -- 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
Re: [symfony-users] Accessing Databases not specified in databases.yml
I had to do something like that some time ago to integrate the logins of 2 soft we were using (not our code) and did so using triggers in mysql. On Tue, Sep 7, 2010 at 2:07 PM, DEEPAK BHATIA toreachdee...@gmail.comwrote: Hi, I have four projects in the htdocs directory and each have separate database in databases.yml. Now I have user login/password in each of the four different databases. How can I write the code in symfony when user change password, it gets changed in all the databases. Regards Deepak Bhatia -- 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 -- 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
Re: [symfony-users] Accessing Databases not specified in databases.yml
I absolutely cannot and I'm sorry for that! It was a few years ago that I did it! My original meaning was that you probably would not need any PHP and symfony in here. See the mysql doc about triggers and stored procedures: On certain actions (any password modification in your case) you will start a trigger that can perform a stored procedure (sql script) to copy the new value everywhere you need. This would be handled directly within mysql and only within mysql. On Tue, Sep 7, 2010 at 5:49 PM, DEEPAK BHATIA toreachdee...@gmail.comwrote: Hi, Thanks for your mail. Can get some google link which is useful or send me some sample code of mysql trigger and how it gets invoked in symfony project ? Regards Deepak Bhatia On Tue, Sep 7, 2010 at 2:31 PM, Sebastien Armand [Pink] khe...@gmail.comwrote: I had to do something like that some time ago to integrate the logins of 2 soft we were using (not our code) and did so using triggers in mysql. On Tue, Sep 7, 2010 at 2:07 PM, DEEPAK BHATIA toreachdee...@gmail.comwrote: Hi, I have four projects in the htdocs directory and each have separate database in databases.yml. Now I have user login/password in each of the four different databases. How can I write the code in symfony when user change password, it gets changed in all the databases. Regards Deepak Bhatia -- 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 -- 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 -- 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 -- 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] Inheritance issue...
Hello everyone, I have a few classes of my model on top of which I wanted to add search capabilities through their 'Table' classes. After realizing that many functions I'm gonna create here will be similar from one Table class to the other I wanted to refactor all of this in one common place. So at first I started creating an abstract Search Class thinking that I would use my Table class and create a new one that extends both the Table and the Search class into a SearchableTable class. So if we think about Jobeet jobs I would have a new JobSearchableTable class. Of course multiple inheritance does not work! And I'm not interested in creating interfaces, cause I actually want those common search methods implemented somewhere. Right now what I am doing is that the Search class extends Doctrine_Table, and then I changed my Table class so it extends my new class. And everything seems good like that. However this only works because the Table classes directly extend Doctrine_Table. But if I wanted to have the same kind of ability on the model classes themselves I would be completely screwed because they extend the base classes which then extend Doctrine_Record. Or would there be a way to do something about that? -- 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
Re: [symfony-users] Re: Inheritance issue...
Hmmm, yeah! Hadn't thought about behaviors, but they'd do the job perfectly I guess! Thanks On Fri, Sep 3, 2010 at 1:25 PM, Raphael Schumacher m...@raphaelschumacher.ch wrote: You may check out whether the behavior features in Doctrine may serve you for your need: - use the Searchable behavior/template provided by Doctrine, or - develop your own Doctrine behavior that suits your exact needs For the latter, refer to http://www.symfony-project.org/more-with-symfony/1_4/en/08-Advanced-Doctrine-Usage If I understand you correctly: yes there is not sort of BaseTable class that is between a generated MyClassTable and Doctrine_Table. That could probably help for your need, but as above-mentioned there are behaviors available instead that can be hooked onto the Doctrine table/record classes for any entity that you wish to enhance with your search functionality. Hope that helps, RAPHAEL On 3 Sep., 05:54, Sebastien Armand [Pink] khe...@gmail.com wrote: Hello everyone, I have a few classes of my model on top of which I wanted to add search capabilities through their 'Table' classes. After realizing that many functions I'm gonna create here will be similar from one Table class to the other I wanted to refactor all of this in one common place. So at first I started creating an abstract Search Class thinking that I would use my Table class and create a new one that extends both the Table and the Search class into a SearchableTable class. So if we think about Jobeet jobs I would have a new JobSearchableTable class. Of course multiple inheritance does not work! And I'm not interested in creating interfaces, cause I actually want those common search methods implemented somewhere. Right now what I am doing is that the Search class extends Doctrine_Table, and then I changed my Table class so it extends my new class. And everything seems good like that. However this only works because the Table classes directly extend Doctrine_Table. But if I wanted to have the same kind of ability on the model classes themselves I would be completely screwed because they extend the base classes which then extend Doctrine_Record. Or would there be a way to do something about that? -- 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 -- 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
Re: [symfony-users] sfGuardUser with an alias of s in your query does not reference the parent component it is related to.
The left join with Doctrine works on the Relation defined in the schema.yml (or not, depending if you're using this way to define your model). In a doctrine query like this, you need to use that relation name and use the prefix of the class you're already querying to it. So for example: model = company: columns: name: logo: etc... relations: Users: class: sfGuardUser then to query a company and the attached user you would need to do: $q = new Doctrine_Query(); $q-from('Company c')-leftJoin('c.Users') So you need the prefix 'c.' in order to say that you join the users related to this company. And the name used should not necessarily be the name of the model, but the name of the relation. In your case since you add this to a possibly already existing query, you will not necessarily know if the root alias is 'c' or 'comp' or whatever. But I think you can access it through $q-getRootAlias(). 2010/8/29 Inform4tic4mente inform4tic4me...@gmail.com I got the error reported in subject when tryng to do something like this: public function addWithUserQuery (DoctrineQuery $q = null) { if (is_null($q)) { $q = $this-createQuery(); } $q-leftJoin('sfGuardUser s'); return $q; } in a table class. I'm pretty new to symfony, and I have no clue on what this error means. I'm using the the latest svn revision in 1.4 branch. Anyone can help, 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.comsymfony-users%2bunsubscr...@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
Re: [symfony-users] saving a form without displayig it
Why do you create a Form for this instead of just directly using $c2-save()? 2010/8/27 cosmy c.zec...@gmail.com Hi all. I want to duplicate some inserted categories (retrieved by a query) of my model changing some attribute. I've written this code in a backend action but it doesn't work foreach($categories as $category){ $c2 = new Category(); $c2 = clone $category; $c2-setCustomer($customer); $c2-setId_interview('NULL'); $c2-setId(''); //don't want the same id of $category!! $categoryform = new CategoryForm($c2); $category2 = $categoryform-save(); } I receive this error: 500 | Internal Server Error | sfValidatorErrorSchema stack trace * at () in SF_ROOT_DIR/lib/form/doctrine/base/BaseCategoryForm.class.php line 85 ... $this-widgetSchema-setNameFormat('category[%s]'); $this-errorSchema = new sfValidatorErrorSchema($this-validatorSchema); $this-setupInheritance(); What's wrong with it? the $categories i'm going to duplicate are stored in the DB, so they wouldn't contain invalid values -- 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 -- 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
Re: [symfony-users] Using 'IN' in a subquery with doctrine
Where shall I send the chocolates then haha??? Thanks a lot! 2010/8/27 Georg geor...@have2.com I see. so if the model looks like this panel: columns: id: furniture_id: relations: furniture: {local: furniture_id, foreign: id, foreignAlias: panels} you should be able to do it like this: $query = new Doctrine_Query(); $query-select('f.*')-distinct()-from('furniture f')-leftJoin('f.panels p')-whereIn('p.id', array(1,7,8,9)); Am 27.08.2010 07:50, schrieb Sebastien Armand [Pink]: Ok, probably did not explain myself very well then. I receive an array of panel Ids that I know have issues, but since the panels are only parts of a bigger thing that is a furniture, I'm not interested in showing anyone that those panel have issues, I'd rather show that the bigger furniture as a whole has issues. Therefore, upon receiving that list of troubled panels, I want to get all the related furniture (each panel has one and only one furniture) and display it later. The model is something like: furniture: id: other_non_relevant_columns: panel: id: furniture_id: other_non_relevant_stuff: The solution you just described here works, but as you said it's an ugly cheat (still looking better than the one I'm currently using though!) 2010/8/27 Georg geor...@have2.com mailto:geor...@have2.com Actually I do not understant what you want to do. You have a group of panels, and want to find a group of furniture so that no panel is without furniture. But I can't image what you want to do with this information without the relation to each panel. I have no good solution for your problem, only an ugly cheat :-( $pids = array(1,7,8,9); Doctrine_Query::create()-from('Furniture f')-where('f.id http://f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id http://pa.id IN ('.implode(', ', array_fill(0, count($pids), '?').') )', $pids); Am 27.08.2010 05:05, schrieb Sebastien Armand [Pink]: It wouldn't be whereIn('f.id http://f.id http://f.id', array(1,7,8,9)), because 1,7,8,9 are the ids of the panels. So I tried fetching the first request as an array (that I did hope would be an array of Ids) and using that array in whereIn('f.id http://f.id http://f.id', $furnitureIdArray) But it turns out this array is like this: [ 0 = [ 'id' = '1' , 'furniture_id' = 7 ] , 1 = [ 'id' = '8' , 'furniture_id' = 79 ] ] So the only solution I found from there was to go through that whole array and build an array where I only have the furniture ids for my second request. Still I don't like that solution in that: - I have to query the DB 2 times instead of using a subquery - I have to loop through my first query results to build the arguments of the second query. - Something seems pretty wrong in here when I do all this! 2010/8/26 Georg geor...@have2.com mailto:geor...@have2.com mailto:geor...@have2.com mailto:geor...@have2.com try whereIn('f.id http://f.id http://f.id', array(1,7,8,9)) Am 26.08.2010 11:12, schrieb Sebastien Armand [Pink]: 'IN' being one of the worst possible keyword to search online ever, I found nothing interesting to solve my problem, so here it goes: My query should look something like this: Doctrine_Query::create()-from('Furniture f')-where('f.id http://f.id http://f.id http://f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id http://pa.id http://pa.id http://pa.id IN ? )', array(array(1,7,8,9)); so each 'furniture' has many panels, and a panel has a furniture_id. I received a list of panel ids and want to get all the furnitures (sorry for the awful plural) linked to those panels. Doing it this way, when I output the DQL, I see: IN (?,?,?,?), but then have an error: Invalid parameter number: number of bound variables does not match number of tokens If I change the double array into just one array, then the DQL only reads: IN ? and I get the same error since I have 4 parameters but only 1 question mark. I also tried creating another doctrine query on panels: $panQuery = Doctrine_Query::create()- select('pa.furniture_id')- from('Panel pa')- whereIn('pa.id http://pa.id http://pa.id http://pa.id', array(1,7,8,9)); and having my global query like
[symfony-users] Using 'IN' in a subquery with doctrine
'IN' being one of the worst possible keyword to search online ever, I found nothing interesting to solve my problem, so here it goes: My query should look something like this: Doctrine_Query::create()-from('Furniture f')-where('f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id IN ? )', array(array(1,7,8,9)); so each 'furniture' has many panels, and a panel has a furniture_id. I received a list of panel ids and want to get all the furnitures (sorry for the awful plural) linked to those panels. Doing it this way, when I output the DQL, I see: IN (?,?,?,?), but then have an error: Invalid parameter number: number of bound variables does not match number of tokensIf I change the double array into just one array, then the DQL only reads: IN ? and I get the same error since I have 4 parameters but only 1 question mark. I also tried creating another doctrine query on panels: $panQuery = Doctrine_Query::create()- select('pa.furniture_id')- from('Panel pa')- whereIn('pa.id', array(1,7,8,9)); and having my global query like this: $q =Doctrine_Query::create() -from('Furniture f') -where('f.id IN (?) ', $panQuery-getDql()); The output Dql is something I can get, put in my phpMyAdmin and I will get 2 results. I get 0 through doctrine though. Any advice on how to use IN within subqueries is very much 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
Re: [symfony-users] Using 'IN' in a subquery with doctrine
It wouldn't be whereIn('f.id', array(1,7,8,9)), because 1,7,8,9 are the ids of the panels. So I tried fetching the first request as an array (that I did hope would be an array of Ids) and using that array in whereIn('f.id', $furnitureIdArray) But it turns out this array is like this: [ 0 = [ 'id' = '1' , 'furniture_id' = 7 ] , 1 = [ 'id' = '8' , 'furniture_id' = 79 ] ] So the only solution I found from there was to go through that whole array and build an array where I only have the furniture ids for my second request. Still I don't like that solution in that: - I have to query the DB 2 times instead of using a subquery - I have to loop through my first query results to build the arguments of the second query. - Something seems pretty wrong in here when I do all this! 2010/8/26 Georg geor...@have2.com try whereIn('f.id', array(1,7,8,9)) Am 26.08.2010 11:12, schrieb Sebastien Armand [Pink]: 'IN' being one of the worst possible keyword to search online ever, I found nothing interesting to solve my problem, so here it goes: My query should look something like this: Doctrine_Query::create()-from('Furniture f')-where('f.id http://f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id http://pa.id IN ? )', array(array(1,7,8,9)); so each 'furniture' has many panels, and a panel has a furniture_id. I received a list of panel ids and want to get all the furnitures (sorry for the awful plural) linked to those panels. Doing it this way, when I output the DQL, I see: IN (?,?,?,?), but then have an error: Invalid parameter number: number of bound variables does not match number of tokens If I change the double array into just one array, then the DQL only reads: IN ? and I get the same error since I have 4 parameters but only 1 question mark. I also tried creating another doctrine query on panels: $panQuery = Doctrine_Query::create()- select('pa.furniture_id')- from('Panel pa')- whereIn('pa.id http://pa.id', array(1,7,8,9)); and having my global query like this: $q =Doctrine_Query::create() -from('Furniture f') -where('f.id http://f.id IN (?) ', $panQuery-getDql()); The output Dql is something I can get, put in my phpMyAdmin and I will get 2 results. I get 0 through doctrine though. Any advice on how to use IN within subqueries is very much 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.comsymfony-users%2bunsubscr...@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.comsymfony-users%2bunsubscr...@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
Re: [symfony-users] Using 'IN' in a subquery with doctrine
Ok, probably did not explain myself very well then. I receive an array of panel Ids that I know have issues, but since the panels are only parts of a bigger thing that is a furniture, I'm not interested in showing anyone that those panel have issues, I'd rather show that the bigger furniture as a whole has issues. Therefore, upon receiving that list of troubled panels, I want to get all the related furniture (each panel has one and only one furniture) and display it later. The model is something like: furniture: id: other_non_relevant_columns: panel: id: furniture_id: other_non_relevant_stuff: The solution you just described here works, but as you said it's an ugly cheat (still looking better than the one I'm currently using though!) 2010/8/27 Georg geor...@have2.com Actually I do not understant what you want to do. You have a group of panels, and want to find a group of furniture so that no panel is without furniture. But I can't image what you want to do with this information without the relation to each panel. I have no good solution for your problem, only an ugly cheat :-( $pids = array(1,7,8,9); Doctrine_Query::create()-from('Furniture f')-where('f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id IN ('.implode(', ', array_fill(0, count($pids), '?').') )', $pids); Am 27.08.2010 05:05, schrieb Sebastien Armand [Pink]: It wouldn't be whereIn('f.id http://f.id', array(1,7,8,9)), because 1,7,8,9 are the ids of the panels. So I tried fetching the first request as an array (that I did hope would be an array of Ids) and using that array in whereIn('f.id http://f.id', $furnitureIdArray) But it turns out this array is like this: [ 0 = [ 'id' = '1' , 'furniture_id' = 7 ] , 1 = [ 'id' = '8' , 'furniture_id' = 79 ] ] So the only solution I found from there was to go through that whole array and build an array where I only have the furniture ids for my second request. Still I don't like that solution in that: - I have to query the DB 2 times instead of using a subquery - I have to loop through my first query results to build the arguments of the second query. - Something seems pretty wrong in here when I do all this! 2010/8/26 Georg geor...@have2.com mailto:geor...@have2.com try whereIn('f.id http://f.id', array(1,7,8,9)) Am 26.08.2010 11:12, schrieb Sebastien Armand [Pink]: 'IN' being one of the worst possible keyword to search online ever, I found nothing interesting to solve my problem, so here it goes: My query should look something like this: Doctrine_Query::create()-from('Furniture f')-where('f.id http://f.id http://f.id IN (SELECT pa.furniture_id FROM Panel pa WHERE pa.id http://pa.id http://pa.id IN ? )', array(array(1,7,8,9)); so each 'furniture' has many panels, and a panel has a furniture_id. I received a list of panel ids and want to get all the furnitures (sorry for the awful plural) linked to those panels. Doing it this way, when I output the DQL, I see: IN (?,?,?,?), but then have an error: Invalid parameter number: number of bound variables does not match number of tokens If I change the double array into just one array, then the DQL only reads: IN ? and I get the same error since I have 4 parameters but only 1 question mark. I also tried creating another doctrine query on panels: $panQuery = Doctrine_Query::create()- select('pa.furniture_id')- from('Panel pa')- whereIn('pa.id http://pa.id http://pa.id', array(1,7,8,9)); and having my global query like this: $q =Doctrine_Query::create() -from('Furniture f') -where('f.id http://f.id http://f.id IN (?) ', $panQuery-getDql()); The output Dql is something I can get, put in my phpMyAdmin and I will get 2 results. I get 0 through doctrine though. Any advice on how to use IN within subqueries is very much welcome! -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com http://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 mailto: symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.comsymfony-users%2bunsubscr...@googlegroups.com mailto:symfony-users%2bunsubscr...@googlegroups.comsymfony-users%252bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: Doctrine : many to many with refclass
If you change your UserPermission definition to this: UserPermission: columns: user_id: type: integer primary: true permission_id: type: integer primary: true relations: User: foreignAlias: UserPermissions Permission: Then you will be able to use: $user-getUserPermissions(); If you just want to create a standard query, then just use the names of the tables like maybe: UserTable::getInstance()-createQuery('u')-leftJoin('UserPermission p')-where('p.some_field = ?', 89); Hope this is what you were looking for, I'm not quite sure what your question actually is ;) 2010/8/21 Ettore ete@gmail.com I don't know if this can solve your problem, anyway have a look at http://www.doctrine-project.org/projects/orm/1.2/docs/manual/defining-models/en#relationships:join-table-associations With user-Permissions you should get a Doctrine_Collection of Doctrine_Records . Creating a new tuple shuld be like: $userPerm = new UserPermission: $userPerm-User = new User() (or existing one) $userPerm-Permission = new Permission() (or existing one) I'm going to facing this problem next days for a project, so i'm not really sure if that's right. -- 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 -- 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
Re: [symfony-users] Re: Embedding form filters
Thanks, I would definitely do that if my actual problem was as simple as my example, the thing is that I actually have 4 tables each of them having at least 4 fields, and that I want to browse on those fields. Like here, I would like to actually see the 'city' field displayed, and be able to use it in my request without any specific school being chosen. 2010/8/12 Tom Ptacnik to...@tomor.cz I don't think that you need embed form filter. Just add a widget for selecting a school into the person formFilter Something like: public function configure() { $this-widgetSchema['school_id'] = new sfWidgetFormDoctrineChoice(array( 'model' = $this-getRelatedModelName('School'), 'method' = 'myMethodForWhatIWhant', 'add_empty' = true )); $this-validatorSchema['school_id']. } Then add this field to the filter, and set that it will have cutom method for creating the query public function getFields() { $fields = parent::getFields(); $fields['school_id'] = 'custom'; return $fields; } Then create the method for altering the query for the filter This is my method for i18n join, so modify this for your WHERE query. You can look into the sfFormFilterDoctrine class, method addForeignKeyQuery. Maybe you can use directly this method from the sfFormFilterDoctrine you can try to not creating the custom method - in the getFields method set type to ForeignKey (maybe foreign_key..) $fields['school_id'] = 'ForeignKey'; public function addSchoolIdColumnQuery($query, $field, $values) { $fieldName = 'title'; $translationAlias = 't'; // Must by the same as in the table_method //$query-leftJoin(sprintf('%s.%s %s', $query-getRootAlias(), 'Translation', $translationAlias)); // Translations already joined in table_method generator settings //echo $query-contains('Translation t'); if (is_array($values) isset($values['is_empty']) $values['is_empty']) { $query-addWhere(sprintf('(%s.%s IS NULL OR %1$s.%2$s = ?)', $translationAlias, $fieldName), array('')); } else if (is_array($values) isset($values['text']) '' != $values['text']) { $query-addWhere(sprintf('%s.%s LIKE ?', $translationAlias, $fieldName), '%'.$values['text'].'%'); } } On 10 srp, 11:23, Sebastien Armand [Pink] khe...@gmail.com wrote: Actually I don't think what I'm looking for is a join, but a set of WHERE conditions like: WHERE person.school_id IN (SELECT school.id FROM School WHERE city = paris) still no clue how to get that though! 2010/8/10 Sebastien Armand [Pink] khe...@gmail.com Hello everyone! New day new issue! let's imagine the following model: person: name: nickname: school_id: school: name: city: I want to have a filter on 'person' to browse through the person database. And in that filter I want to be able to choose the city they studied in. What I did so far is: use the standard PersonFormFilter, this works like a charm, no problem embed a SchoolFormFilter in the PersonFormFilter when doing so, the first problem appears: while binding the PersonFormFilter to its values, the embedded form will not be bound to anything. If trying to bind it separately, I get a csrf error because no csrf token is included in the values for the school. Adding it manually only brings up a csrf attack detection. So disabled the CSRF protection on the embedded form. Now I can get my 2 filters and get a look at the queries generated. What would be wonderful from now is to be able to build a join of those 2 queries. However, the 2 queries being built independently, they are using the same alias: 'r' which causes a conflict. Also it seems a pretty complicated way to work, anyone knows of a better / much more simple and clean solution, or at least can help me going forward? -- 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 -- 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] Embedding form filters
Hello everyone! New day new issue! let's imagine the following model: person: name: nickname: school_id: school: name: city: I want to have a filter on 'person' to browse through the person database. And in that filter I want to be able to choose the city they studied in. What I did so far is: use the standard PersonFormFilter, this works like a charm, no problem embed a SchoolFormFilter in the PersonFormFilter when doing so, the first problem appears: while binding the PersonFormFilter to its values, the embedded form will not be bound to anything. If trying to bind it separately, I get a csrf error because no csrf token is included in the values for the school. Adding it manually only brings up a csrf attack detection. So disabled the CSRF protection on the embedded form. Now I can get my 2 filters and get a look at the queries generated. What would be wonderful from now is to be able to build a join of those 2 queries. However, the 2 queries being built independently, they are using the same alias: 'r' which causes a conflict. Also it seems a pretty complicated way to work, anyone knows of a better / much more simple and clean solution, or at least can help me going forward? -- 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
Re: [symfony-users] Re: Urls in Javascript
Have found a way to do it, this is through use_dynamic_javascript('route'); the route here will point for example at a javascript module javascript/mydynamicscript and can use the '.js' format. then you can skip the mydynamicscript action and directly go to the template mydynamicscriptSuccess.js.php In this template you can put your script and use the php tags to echo the links needed. Not sure yet which solution I will personally use, but thought the solution might be useful for some of us! 2010/8/9 Kevin kevinb...@gmail.com I have also run into this problem. Using the href/action works great for links and forms but isn't always applicable since some ajax calls don't rely on those html items. What I do is set a dummy meta tag with the url in it and pull that in with javascript. Not the best solution but at least I can keep my javascript completely seperate... I have discussed this before: http://groups.google.ca/group/symfony-users/browse_thread/thread/50389a8ad4d987c/d983f5b09c512702?lnk=gstq=ajax+url#d983f5b09c512702 The ideal soltion would be to use the html5 data attribute: http://ejohn.org/blog/html-5-data-attributes/ but using this breaks xhtml validation... - Kevin On Aug 9, 1:16 am, Sebastien Armand [Pink] khe...@gmail.com wrote: In both your suggestions, if I get them correctly, the idea is that from a template, I should output some javascript to set some variables or any other way to get the url back from my javascript later. Which seems weird to me, and wrong on the side that I don't really want to add js in my templates and prefer to keep it separate. For an idea, my case goes like this: I have a form to enter some information of a sofa for example, and one of the fields allows me to chose a design for the sofa. This design has some default dimensions: width and length. Those are the information I want to bring back through ajax. So: 1. get to the form page to create a new sofa 2. choose a design 3. this triggers the JS to go look for the default size (from the design module) and fill it in the form. my js file is in the js folder and in it I have a url linking to /design/:design_id.json but for this to work on my dev environment, I need that url to be: /frontend_dev.php/design/:design_id.json. So is there a way to output that url in the js through php and symfony? Or a way that I can get it through the dom but without already having to put it here by myself beforehand? 2010/8/7 Stéphane stephane.er...@gmail.com It shouldnt break. You should do this: Create a route to reach your module/action (/apps/$app/config/routing.yml, check doc). Then in a template, write something like: script type=text/javascript window.myactionurl = ?php echo url_for('@my_route')?; alert(window.myactionurl); $.post(window.myactionurl, null, function(data){//...}); /script This is a stupid example (about the window.myactionurl, store this somewhere else). Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Sat, Aug 7, 2010 at 12:25 PM, Phennim phen...@gmail.com wrote: Get the url from the DOM using js. $('a.do-ajax').click(function(){ var url = $(this).attr('href'); $.post(url, function(data){ //do stuff }); }); On Aug 7, 11:11 am, Sebastien Armand [Pink] khe...@gmail.com wrote: Hello everyone, I was wondering how to get an environment independent url in javascript files. My js needs to connect to the server and get some JSON data and update a form on certain actions. But putting that actions url in the js directly breaks everything when you change environment... I might be missing something here but don't see the light of how to do it, any insight 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.comsymfony-users%2bunsubscr...@googlegroups.com symfony-users%2bunsubscr...@googlegroups.comsymfony-users%252bunsubscr...@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.comsymfony-users%2bunsubscr...@googlegroups.com symfony-users
[symfony-users] Re: Embedding form filters
Actually I don't think what I'm looking for is a join, but a set of WHERE conditions like: WHERE person.school_id IN (SELECT school.id FROM School WHERE city = paris) still no clue how to get that though! 2010/8/10 Sebastien Armand [Pink] khe...@gmail.com Hello everyone! New day new issue! let's imagine the following model: person: name: nickname: school_id: school: name: city: I want to have a filter on 'person' to browse through the person database. And in that filter I want to be able to choose the city they studied in. What I did so far is: use the standard PersonFormFilter, this works like a charm, no problem embed a SchoolFormFilter in the PersonFormFilter when doing so, the first problem appears: while binding the PersonFormFilter to its values, the embedded form will not be bound to anything. If trying to bind it separately, I get a csrf error because no csrf token is included in the values for the school. Adding it manually only brings up a csrf attack detection. So disabled the CSRF protection on the embedded form. Now I can get my 2 filters and get a look at the queries generated. What would be wonderful from now is to be able to build a join of those 2 queries. However, the 2 queries being built independently, they are using the same alias: 'r' which causes a conflict. Also it seems a pretty complicated way to work, anyone knows of a better / much more simple and clean solution, or at least can help me going forward? -- 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
Re: [symfony-users] Re: Urls in Javascript
In both your suggestions, if I get them correctly, the idea is that from a template, I should output some javascript to set some variables or any other way to get the url back from my javascript later. Which seems weird to me, and wrong on the side that I don't really want to add js in my templates and prefer to keep it separate. For an idea, my case goes like this: I have a form to enter some information of a sofa for example, and one of the fields allows me to chose a design for the sofa. This design has some default dimensions: width and length. Those are the information I want to bring back through ajax. So: 1. get to the form page to create a new sofa 2. choose a design 3. this triggers the JS to go look for the default size (from the design module) and fill it in the form. my js file is in the js folder and in it I have a url linking to /design/:design_id.json but for this to work on my dev environment, I need that url to be: /frontend_dev.php/design/:design_id.json. So is there a way to output that url in the js through php and symfony? Or a way that I can get it through the dom but without already having to put it here by myself beforehand? 2010/8/7 Stéphane stephane.er...@gmail.com It shouldnt break. You should do this: Create a route to reach your module/action (/apps/$app/config/routing.yml, check doc). Then in a template, write something like: script type=text/javascript window.myactionurl = ?php echo url_for('@my_route')?; alert(window.myactionurl); $.post(window.myactionurl, null, function(data){//...}); /script This is a stupid example (about the window.myactionurl, store this somewhere else). Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Sat, Aug 7, 2010 at 12:25 PM, Phennim phen...@gmail.com wrote: Get the url from the DOM using js. $('a.do-ajax').click(function(){ var url = $(this).attr('href'); $.post(url, function(data){ //do stuff }); }); On Aug 7, 11:11 am, Sebastien Armand [Pink] khe...@gmail.com wrote: Hello everyone, I was wondering how to get an environment independent url in javascript files. My js needs to connect to the server and get some JSON data and update a form on certain actions. But putting that actions url in the js directly breaks everything when you change environment... I might be missing something here but don't see the light of how to do it, any insight 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.comsymfony-users%2bunsubscr...@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.comsymfony-users%2bunsubscr...@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
[symfony-users] Customizable processes
Hello everyone, I am soon to start a new symfony based project that will have to be customized / adapted depending on the company that is going to use it. All those are sub-companies of our company and work on the same topic, with processes that are similar but not identical. And get more or less complex depending on the size of the company. Most of the basic actions that will be taken on the system are common ones, I mean creating a contract, requires at least getting a client a product and a price together, no matter how you wish to do it. But they might occur in a certain order for a company and in a different order in a second company. Or some steps like a validation or approval might be required somewhere but completely useless for other companies and therefore troublesome if we keep such steps active for them. I have read a bit about the event dispatcher and events in Symfony and think there might be something here that could help us although I don't see clearly yet how it could be used to customize the workflow of certain business objects. And of course that workflow would have to be adapted for different companies outside of the code. Even if it's something that has to generate code for the project later on or whatever. The primary definition of that workflow should be a configuration file of any kind. I'm pretty sure that this need is something that has already been required by other people. I'm also pretty sure that I don't have the right vocabulary to describe it right now otherwise google would send me some information about what I'm looking for! Any insight on this issue / link towards interesting readings that I missed would be very much appreciated. 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
Re: [symfony-users] Customizable processes
Probably each of them will have their own install for now. I took a look at ez components that has a workflow component. But I need to spend a lot more time on it to understand what it actually does and from there on, how it could be used in our case. 2010/6/30 Georg geor...@have2.com I too would be very interested in a workflow engine/builder of some kind. Has anybody realised any part of this in a project? @Sebastien: Do you want to run all sub company custom processes in one symfony installation, or does each sub company receive their own installation? BR Georg Am 30.06.2010 08:26, schrieb Sebastien Armand [Pink]: Hello everyone, I am soon to start a new symfony based project that will have to be customized / adapted depending on the company that is going to use it. All those are sub-companies of our company and work on the same topic, with processes that are similar but not identical. And get more or less complex depending on the size of the company. Most of the basic actions that will be taken on the system are common ones, I mean creating a contract, requires at least getting a client a product and a price together, no matter how you wish to do it. But they might occur in a certain order for a company and in a different order in a second company. Or some steps like a validation or approval might be required somewhere but completely useless for other companies and therefore troublesome if we keep such steps active for them. I have read a bit about the event dispatcher and events in Symfony and think there might be something here that could help us although I don't see clearly yet how it could be used to customize the workflow of certain business objects. And of course that workflow would have to be adapted for different companies outside of the code. Even if it's something that has to generate code for the project later on or whatever. The primary definition of that workflow should be a configuration file of any kind. I'm pretty sure that this need is something that has already been required by other people. I'm also pretty sure that I don't have the right vocabulary to describe it right now otherwise google would send me some information about what I'm looking for! Any insight on this issue / link towards interesting readings that I missed would be very much appreciated. 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.comsymfony-users%2bunsubscr...@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.comsymfony-users%2bunsubscr...@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
[symfony-users] Re: how to get current login user id in my commonclass??
If I remember, calling sfContext::getInstance() is not really recommended because the context is not always defined (if you are performing tests or run the CLI for example, but I'm not 100% sure) and the preferred way is to pass the information to the class you want to use from the action: $myClassObject-myMethod($this-getUser()); or $myClassObject-setUser($this-getUser()); $myClassObject-myMethod(); 2009/9/16 Avani avani.v.puj...@gmail.com Hi Olly, Thanks a lot.. It's working :) On Sep 15, 4:29 pm, Oliver Jackson ojack...@valleyt.co.uk wrote: Avani wrote: Hello Everyone, I have one common class for my own functions and I have stored it in lib/common.class.php My problem is, how to get current login userid from that class? I tried 1. $this-getUser()-getProfile()-getUserId(); 2. $sf_user-getProfile()-getUserId(); Try: sfContext::getInstance()-getUser()-getProfile()-getUserId(); Olly -- Oliver Jackson - Senior Developer Valley Technology - +44 (0)131 553 0412 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---