[symfony-users] Re: Wrong Table Alias (Doctrine Admin Generator)
+1 !! I also have problems with count queries not respecting the alias I set for a table in join statements On Nov 11, 7:52 am, mintao wrote: > Hi, > > Not sure if this or the doctrine newsgroup is the right place to post > this question/bug. > > It's about the doctrine admin generator for the symfony backend. > As described at page 157 of the Jobeet tutorial Symfony 1.3, Doctrine > 1.2 I wanted to modify the list (of auctions). > > /apps/backend/auctions/config/generator.yml: > [...] > config: > [...] > list: > title: List of all auctions > display: [is_active, =product, ends, starts, min_price, user] > sort: [ends, desc] > object_actions: > _edit: ~ > table_method: retrieveBackendAuctionList > > /lib/model/AuctionsTable.class.php: > [...] > public function retrieveBackendAuctionList(Doctrine_Query $q) > { > $rootAlias = $q->getRootAlias(); > $q ->andWhere('(isnull('.$rootAlias.'.starts) OR ' . $rootAlias . > '.starts ->andWhere($rootAlias.'.ends>NOW()') > ; > return $q; > } > > The Error: > SQLSTATE[42S22]: Column not found: 1054 Unknown column 'r.starts' in > 'where clause'. Failing Query: "SELECT COUNT(*) AS `num_results` FROM > `auctions` `a` WHERE (isnull(r.starts) OR `a`.`starts` < NOW()) AND > `a`.`ends` > NOW()" > > As you can see, it's the same variable $rootAlias ... so it's replaced > once by "r" and the other two times by "a" as table alias. > > Any ideas? Thanks :) > > Florian --~--~-~--~~~---~--~~ 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] Dependency injection component & conditionnal dependencies
Hi, I just went through the whole DI documentation, but I'm still left with 2 question : I want to build an environment where plugins will define services. I'm planning have each plugin specify their own service definitions, in XML too, which I think would be the way to go about it. The 1st question is : how can I make dependencies optionnal ? E.g: plugin A *may* use plugin *B* in the case it is installed. How can I express that in the XML service description ? In other words, I was wondering if there was a XML equivalent of $def = new sfServiceDefinition(); $def->setClass('myProjectService'); if($container->hasService('time_tracking')) $def->addMethodCall('setTimeTracker',array(new sfServiceReference ('time_tracker'))); If not, how would you manage the following situation : to test if a service exists, it must have been declared, but you cannot control the order in which your plugin's code would be executed (which in this case should be related to the service dependency graph, starting with the leafs and so on) thanks in advance for clarifying this , Julien Keable --~--~-~--~~~---~--~~ 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 problem trying to add null relation object
I had the same problem here. Jon told me to do $object->related_id = null; $object->save(); and now it seems to work good luck On May 21, 5:32 am, wissl wrote: > Not sure if you registered it before, so I ask you to get a > confirmation: Did you try to add "notnull: false" to your schema > definition? > > buyer_id: { type: integer(4), notnull: false } > > We do similar things to that and it works without any problems... > > On May 19, 10:00 pm, Tom Haskins-Vaughan > wrote: > > > symfony 1.2 > > > Hi, > > > I have the following shopping cart class: > > > Cart: > > actAs: [Timestampable] > > columns: > > buyer_id: { type: integer(4) } > > is_default: { type: boolean, default: false } > > relations: > > Buyer: > > class: sfGuardUser > > local: buyer_id > > foreign: id > > > Now, when someone visits the site, and before logging in, I need to > > creat a new Cart with no buyer id. But When I try to do this I get: > > > 500 | Internal Server Error | Doctrine_Validator_Exception > > Validation failed in class sfGuardUser > > > 1 field had validation error: > > > * 1 validator failed on username (notnull) > > > So, I assume Doctrine is trying to create a new sfGuardUser to add to > > the cart. But I want the buyer_id to be null until s/he logs in. > > > Any ideas? > > > Thanks. > > > Tom --~--~-~--~~~---~--~~ 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: Plugins inside of a plugin
Haha ! I just found what you commited 4 hours ago :) On Mar 5, 8:47 pm, jukea wrote: > I'm about to start building the same thing here, and since this plugin > seems to be publicly available, I'd be appreciated if you could give > us a taste of what's coming. What timeframe do you plan for the first > alpha release ? How open is this to contributors ? > > Julien > > On Mar 5, 8:07 pm, Jonathan Wage wrote: > > > Yes. > > > - Jon > > > On Thu, Mar 5, 2009 at 7:02 PM, jukea wrote: > > > > Jonathan, > > > > can you describe a bit that Sympal plugin that I'm curious about ? Is > > > it like some kind of framework implementing menus/permissions/etc... > > > like drupal does ? > > > > One can hope .. :) > > > > On Mar 5, 3:03 pm, Jonathan Wage wrote: > > > > I think I am fine with that. > > > > > $sympalPluginPath = dirname(__FILE__).'/../../../..'; > > > > $this->setPluginPath('sfSympalPlugin', $sympalPluginPath); > > > > > $embeddedPluginPath = $sympalPluginPath.'/lib/plugins'; > > > > $embeddedPlugins = > > > > sfFinder::type('dir')->relative()->maxdepth(0)->in($embeddedPluginPath); > > > > foreach ($embeddedPlugins as $plugin) > > > > { > > > > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > > > > } > > > > > This is the test project in sfSympalPlugin and that works fine. > > > > > Thanks for the help. > > > > > - Jon > > > > > On Mon, Mar 2, 2009 at 4:57 PM, Matthias N. < > > > > > matthias.nothh...@googlemail.com> wrote: > > > > > > On 2 Mrz., 21:41, Jonathan Wage wrote: > > > > > > On Mon, Mar 2, 2009 at 12:15 PM, Matthias N. < > > > > > > > matthias.nothh...@googlemail.com> wrote: > > > > > > > > On 1 Mrz., 23:22, Jonathan Wage wrote: > > > > > > > > In that case it would load the one in the project plugins > > > > > > > > folder, > > > and > > > > > > > > sfSympalPlugin wouldn't load the bundled plugin if it has > > > > > > > > already > > > > > been > > > > > > > > loaded. > > > > > > > > I think to solve this, two things must be changed in the > > > > > > > sfProjectConfiguration class: > > > > > > > > - additionally search for plugins in plugins/*/plugins > > > > > > > - allow to lazy load (enable) plugins > > > > > > > > Then, in your plugin configuration class you can enable plugins/ > > > > > > > sfSympalPlugin/plugins/sfDoctrineGuardPlugin when a > > > > > > > "sfDoctrineGuardPlugin" was not enabled before. > > > > > > > This is exactly what I did to allow this. I was able to accomplish > > > > > > it > > > a > > > > > few > > > > > > different ways, but not without modifying core. > > > > > > Hm.. if you don't need "lazy loading" it would be enough to change the > > > > > project configuration to automatically enable all plugins found in > > > > > enabled plugins/*/plugins folders. And this should not require too > > > > > much changes in sfProjectConfiguration. > > > > > > But you are right: I don't see a way for you to get this work without > > > > > a change in the core. > > > > > > For sf 1.2 you could provide code to manually enable these embedded > > > > > plugins by a similar hack like this in ProjectConfiguration->setup(): > > > > > > > > > > > $embeddedPluginPath = dirname(__FILE__').'/../plugins/sfSympalPlugin/ > > > > > plugins'; > > > > > $embeddedPlugins = sfFinder::type('dir')->relative()->maxdepth(0)->in > > > > > ($embeddedPluginPath); > > > > > foreach ($embeddedPlugins as $plugin) > > > > > { > > > > > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > > > > > } > > > > > > $this->enablePlugins($embeddedPlugins); > > > > > > > > > > > But it requires the user to do this manually. > > > > > > > > It should not make
[symfony-users] Re: Plugins inside of a plugin
I'm about to start building the same thing here, and since this plugin seems to be publicly available, I'd be appreciated if you could give us a taste of what's coming. What timeframe do you plan for the first alpha release ? How open is this to contributors ? Julien On Mar 5, 8:07 pm, Jonathan Wage wrote: > Yes. > > - Jon > > > > On Thu, Mar 5, 2009 at 7:02 PM, jukea wrote: > > > Jonathan, > > > can you describe a bit that Sympal plugin that I'm curious about ? Is > > it like some kind of framework implementing menus/permissions/etc... > > like drupal does ? > > > One can hope .. :) > > > On Mar 5, 3:03 pm, Jonathan Wage wrote: > > > I think I am fine with that. > > > > $sympalPluginPath = dirname(__FILE__).'/../../../..'; > > > $this->setPluginPath('sfSympalPlugin', $sympalPluginPath); > > > > $embeddedPluginPath = $sympalPluginPath.'/lib/plugins'; > > > $embeddedPlugins = > > > sfFinder::type('dir')->relative()->maxdepth(0)->in($embeddedPluginPath); > > > foreach ($embeddedPlugins as $plugin) > > > { > > > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > > > } > > > > This is the test project in sfSympalPlugin and that works fine. > > > > Thanks for the help. > > > > - Jon > > > > On Mon, Mar 2, 2009 at 4:57 PM, Matthias N. < > > > > matthias.nothh...@googlemail.com> wrote: > > > > > On 2 Mrz., 21:41, Jonathan Wage wrote: > > > > > On Mon, Mar 2, 2009 at 12:15 PM, Matthias N. < > > > > > > matthias.nothh...@googlemail.com> wrote: > > > > > > > On 1 Mrz., 23:22, Jonathan Wage wrote: > > > > > > > In that case it would load the one in the project plugins folder, > > and > > > > > > > sfSympalPlugin wouldn't load the bundled plugin if it has already > > > > been > > > > > > > loaded. > > > > > > > I think to solve this, two things must be changed in the > > > > > > sfProjectConfiguration class: > > > > > > > - additionally search for plugins in plugins/*/plugins > > > > > > - allow to lazy load (enable) plugins > > > > > > > Then, in your plugin configuration class you can enable plugins/ > > > > > > sfSympalPlugin/plugins/sfDoctrineGuardPlugin when a > > > > > > "sfDoctrineGuardPlugin" was not enabled before. > > > > > > This is exactly what I did to allow this. I was able to accomplish it > > a > > > > few > > > > > different ways, but not without modifying core. > > > > > Hm.. if you don't need "lazy loading" it would be enough to change the > > > > project configuration to automatically enable all plugins found in > > > > enabled plugins/*/plugins folders. And this should not require too > > > > much changes in sfProjectConfiguration. > > > > > But you are right: I don't see a way for you to get this work without > > > > a change in the core. > > > > > For sf 1.2 you could provide code to manually enable these embedded > > > > plugins by a similar hack like this in ProjectConfiguration->setup(): > > > > > > > > > $embeddedPluginPath = dirname(__FILE__').'/../plugins/sfSympalPlugin/ > > > > plugins'; > > > > $embeddedPlugins = sfFinder::type('dir')->relative()->maxdepth(0)->in > > > > ($embeddedPluginPath); > > > > foreach ($embeddedPlugins as $plugin) > > > > { > > > > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > > > > } > > > > > $this->enablePlugins($embeddedPlugins); > > > > > > > > > But it requires the user to do this manually. > > > > > > > It should not make a difference no matter where a plugin is loaded > > > > > > from. > > > > > > > But I wonder why you really need this? > > > > > > I need/want this because sfSympalPlugin is more like an extension of > > > > symfony > > > > > and to make things more maintainable I split the core in to multiple > > > > > plugins. This just makes things in to smaller more maintainable > > pieces. > > > > The > > > > > other reason is s
[symfony-users] Re: I18n in forms messages
oops, typo error . What I meant was : maybe you could try this : __('Blbalba %parameter%',__($columnName)); instead of this : __('Blabla %parameter%', $columnName); --~--~-~--~~~---~--~~ 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: I18n in forms messages
just an idea here .. maybe you could try this : __('Blbalba %parameter%',__($columnName)); instead of this : __('Blabla $parameter%', %columnName); On Mar 5, 6:04 pm, boozee wrote: > anyone? please ? > > On Mar 5, 2:44 am, boozee wrote: > > > Hello, > > > I have made a section in my messages.he.xml to translate the "An > > object with the same "%column%" already exist." message, to my local > > language. > > However, while most of the sentence was translated fine, the content > > of %column% - the name of the column (username for example) - wasn't > > translated, and was kept in the english language, even though I have a > > section for "username" (and "Username" as well) in the messages.he.xml > > file. > > > Am I missing something ? > > Can someone help ? > > > Thanx --~--~-~--~~~---~--~~ 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: Plugins inside of a plugin
Jonathan, can you describe a bit that Sympal plugin that I'm curious about ? Is it like some kind of framework implementing menus/permissions/etc... like drupal does ? One can hope .. :) On Mar 5, 3:03 pm, Jonathan Wage wrote: > I think I am fine with that. > > $sympalPluginPath = dirname(__FILE__).'/../../../..'; > $this->setPluginPath('sfSympalPlugin', $sympalPluginPath); > > $embeddedPluginPath = $sympalPluginPath.'/lib/plugins'; > $embeddedPlugins = > sfFinder::type('dir')->relative()->maxdepth(0)->in($embeddedPluginPath); > foreach ($embeddedPlugins as $plugin) > { > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > } > > This is the test project in sfSympalPlugin and that works fine. > > Thanks for the help. > > - Jon > > On Mon, Mar 2, 2009 at 4:57 PM, Matthias N. < > > > > matthias.nothh...@googlemail.com> wrote: > > > On 2 Mrz., 21:41, Jonathan Wage wrote: > > > On Mon, Mar 2, 2009 at 12:15 PM, Matthias N. < > > > > matthias.nothh...@googlemail.com> wrote: > > > > > On 1 Mrz., 23:22, Jonathan Wage wrote: > > > > > In that case it would load the one in the project plugins folder, and > > > > > sfSympalPlugin wouldn't load the bundled plugin if it has already > > been > > > > > loaded. > > > > > I think to solve this, two things must be changed in the > > > > sfProjectConfiguration class: > > > > > - additionally search for plugins in plugins/*/plugins > > > > - allow to lazy load (enable) plugins > > > > > Then, in your plugin configuration class you can enable plugins/ > > > > sfSympalPlugin/plugins/sfDoctrineGuardPlugin when a > > > > "sfDoctrineGuardPlugin" was not enabled before. > > > > This is exactly what I did to allow this. I was able to accomplish it a > > few > > > different ways, but not without modifying core. > > > Hm.. if you don't need "lazy loading" it would be enough to change the > > project configuration to automatically enable all plugins found in > > enabled plugins/*/plugins folders. And this should not require too > > much changes in sfProjectConfiguration. > > > But you are right: I don't see a way for you to get this work without > > a change in the core. > > > For sf 1.2 you could provide code to manually enable these embedded > > plugins by a similar hack like this in ProjectConfiguration->setup(): > > > > > $embeddedPluginPath = dirname(__FILE__').'/../plugins/sfSympalPlugin/ > > plugins'; > > $embeddedPlugins = sfFinder::type('dir')->relative()->maxdepth(0)->in > > ($embeddedPluginPath); > > foreach ($embeddedPlugins as $plugin) > > { > > $this->setPluginPath($plugin, $embeddedPluginPath.'/'.$plugin); > > } > > > $this->enablePlugins($embeddedPlugins); > > > > > But it requires the user to do this manually. > > > > > It should not make a difference no matter where a plugin is loaded > > > > from. > > > > > But I wonder why you really need this? > > > > I need/want this because sfSympalPlugin is more like an extension of > > symfony > > > and to make things more maintainable I split the core in to multiple > > > plugins. This just makes things in to smaller more maintainable pieces. > > The > > > other reason is since all these plugins are truely a part of the core, I > > > don't want to have separate svn repositories and "plugin page" for them. > > > > > Using dependencies with the pear installer should do it. ;-) > > > > Of course I can accomplish the installing with dependencies in the > > package > > > xml but that is not really the reason for me wanting to do what I am > > doing. > > > I also want all the code in these "core" plugins to be in onehttp:// > > svn.symfony-project.com/plugins/*repository and have one page onhttp:// > >www.symfony-project.com/plugins/* > > > I understand you and I could also imagine situations where I would > > need "embedded plugins". ;-) > > > regards, > > Matthias > > > > > regards, > > > > Matthias > > > > > > On Sun, Mar 1, 2009 at 9:40 AM, naholyr wrote: > > > > > > > And what if you have "plugins/sfSympalPlugin/subPlugins/ > > > > > > sfDoctrineGuardPlugin" AND "plugins/sfDoctrineGuardPlugin" ? Which > > one > > > > > > will be the good plugin to load ? > > > > > > We'd have to deal with very architecture-specific issues like "in > > what > > > > > > order my plugins are loaded ?", and I hate this idea which reminds > > me > > > > > > bad days passed on things like Typo3 :P > > > > > > > On 1 mar, 00:08, Bernhard Schussek wrote: > > > > > > > Hi Jon, > > > > > > > > I already thought about that matter as well, but I don't know of > > any > > > > > > > way how this can be achieved. I guess this could be a nice > > addition > > > > > > > for symfony 1.3, together with a few other plugin enhancements > > such > > > > as > > > > > > > better supported plugin unit&functional testing. > > > > > > > > Bernhard > > > > > > -- > > > > > Jonathan H. Wage > > > > > Open Source Software Developer & > > > > Evangelisthttp://www.jwage.comhttp://www.doctrine-project.orghttp:// > >
[symfony-users] Re: Starting point to make a module to create/update multiple objects at a time?
I don't know access, but are you talking about inline editing ? Like editing you data the way excel would ? If so, I don't think it's done out of the box, see : http://symfony.uservoice.com/pages/symfony/suggestions/109418-add-support-for-inline-editing-in-admin-gen Basically, you could start with a table, and add JS behaviors (i.e : with jquery) to replace the value with an input widget that save the value through AJAX when done. On Mar 5, 7:09 pm, Daniele wrote: > Sorry for my english... I believe there is a misunderstanding. > My aim is to create a page where it is possible enter or edit more > objects at the same time like, just for example, the tabular view in a > table in MS Access. > Thank you for the patience! > > On 5 Mar, 23:13, Lee Bolding wrote: > > > It really depends on how your models are related. It's not really > > clear exactly what it is that you are trying to do. > > > Essentially, you attach the logic to an event (eg preInsert) - so you > > could (for instance) clone your object at that point, change some > > properties, and commit both. > > > I used a Doctrine_Record_Listener to keep user account details > > synchronised in 2 different databases, with different schemas (1 way > > only), and used sfGuard's external authentication facility to > > authenticate against the 'foreign' database. > > > On 5 Mar 2009, at 21:45, Daniele wrote: > > > > Thanks for reply Lee. > > > Yes, I'm using Doctrine! > > > I have taken a look in the documentation at Record Listeners, but I do > > > not understand how listener architecture can help me. > > > Can you give me some additional indication? > > > > On Mar 5, 5:28 pm, Lee Bolding wrote: > > >> If you're using Doctrine, you can use a Doctrine_Record_Listener (or > > >> similar) > > > >> On 5 Mar 2009, at 16:00, Daniele wrote: > > > >>> Hi all, > > > >>> I cannot really understand what is, in Symfony 1.2, the way to > > >>> make a > > >>> module with forms to create or to update multiple instances of a > > >>> model > > >>> at a time. > > > >>> It is possible to start by the class of model's form or is necessary > > >>> to create a completely new form class? > > > >>> Someone know the correct way to start? > > > >>> thanks in advance! --~--~-~--~~~---~--~~ 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 minimum/maximum longitude and longitude
google gives the following : http://mathforum.org/library/drmath/view/61135.html On Mar 3, 10:57 pm, xhe wrote: > I have met a problem. I want to get boundary longitude and latitude of > an area. That is within xxx KM of point A. > If you have the formula, can you please share with me? > > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony Deployment
I've never used it , but from the subject of this thread, I think "phing" should at least be mentionned. From what I understood, it's basically like capistrano , but based on php5. Julien On Mar 1, 4:03 am, "Yevgeniy A. Viktorov" wrote: > On Tue, 2009-02-24 at 13:40 +, Lee Bolding wrote: > > Cool. I'd never heard of Capistrano before... looks promising. > > > Except it needs Ruby, and I don't want to go and install it just for > > this one app. > > > Is there a similar tool written in PERL? *everybody* has PERL... > > not sure about similar tools in PERL, but in php it's > phing:http://nsslive.net/2009/02/16/shell-scripts-no-more/ > > p.s. > I am still prefer capistrano anyway :) --~--~-~--~~~---~--~~ 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: Does sfDoctrineAdminGeneratorWithShowPlugin support table_method?
I don't know, i've never tried it :) as I said, go on the #symfony channel on freenode and look for "pcahard" On Feb 22, 7:50 pm, XinJia wrote: > Voila after svn update. Thanks Jukea. But there should be a little > problem with _show.php, field name can't be shown. It seems the label > of field must be set, isn't it? Thanks. > > - XJ > > On Feb 22, 8:14 am, jukea wrote: > > > I remember talking to the developer about that and asked him to add > > table_method, which he told me he did. Are you checking in the svn > > repository ? > > > the developper is pcahard and is hanging on irc . check freenode's > > #symfony > > > On Feb 21, 8:58 am, XinJia wrote: > > > > Hi, > > > > I don't know if you agree with me on admin generator has show . So > > > this plugin is very helpful, but I found table_method is not > > > available. Please help me. Thanks. > > > > - XJ --~--~-~--~~~---~--~~ 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: Does sfDoctrineAdminGeneratorWithShowPlugin support table_method?
I remember talking to the developer about that and asked him to add table_method, which he told me he did. Are you checking in the svn repository ? the developper is pcahard and is hanging on irc . check freenode's #symfony On Feb 21, 8:58 am, XinJia wrote: > Hi, > > I don't know if you agree with me on admin generator has show . So > this plugin is very helpful, but I found table_method is not > available. Please help me. Thanks. > > - XJ --~--~-~--~~~---~--~~ 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: Passing embedded form from one partial to another
it's because escaping is enabled in your project (settings.yml). You can do something like $form = $form->getRawValue(); to retrieve the original object. Julien On Feb 19, 12:14 pm, Michal G wrote: > Hello, > > I have a release form, which embeds game form. > Release form is rendered by release/_form.php partial. In this partial > i have something like that: > > include_partial("game/formBody", array("form"=>$form['id_game']); > [...] > include_partial("formBody", array("form"=>$form); > > Unfortunately tags rendered by $form[widget]->render() in game/ > _formBody.php are escaped. > In release/_formBody.php everything is ok. > > So, something happens when i pass $form['id_game'] instead of $form. > But what? Is it because of double escaping - first $form is escaped > and then again $form['id_game'], which is already escaped? Or > something else? > > Type of $form variable in game/_formBody.php is > sfOutputEscaperIteratorDecorator. > > How can i fix that? --~--~-~--~~~---~--~~ 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: Best practices for multi form pages
I'd definitely go with embedding forms. From the top of my head, when you build a composite form, it goes like this : - choose a form in which you'll embed other forms (meaning choose a model to base your form upon) - from this form's configure method, embed related objects like this : $relatedObjectForm = new relatedObjectForm($mainObject->relatedObject) $this->embedForm('relatedObjectForm_name', $relatedObjectForm ); - unset primary keys of embedded forms - also unset foreign keys linking to your main object in embeded forms unset($relatedObjectForm['id'],$relatedObjectForm['foreign_id']); the unset part is very important if you want to let the "magic" binding (FK and PK set correctly) happen between your objects. Julien Java Guy wrote: > Hi, > > I've been trying to find a good example for what I'm trying to do: > > I have two types of users: consumers and provider. > The main user profile information is in the consumer table. > Certain specialized users have information in a provider table. > Both consumer and provider have a foreign reference to a user table. > The consumer has a reference to an address table. > > After building my forms, I have several forms: UserForm, ConsumerForm, > ProviderForm, AddressForm. > > My new user registration page populates data into all of these forms. > I have seen some mention of embedding forms or merging multiple forms, > but I'm trying to determine the best way to go about doing this. > > In my first cut, I have just put four different forms on the same > page, and then created some logic to link their underlying database > objects before saving by calling getObject() on the forms and setting > the foreign references, and updating the forms using updateObject(). > > Are there any good examples for how to deal with this kind of > scenario? > > Thanks, > Steve --~--~-~--~~~---~--~~ 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: Could Symfony be easier to use?
+1 for voting/comments on plugins. Also : some plugins are not returned in the search results.. I think this has to do with the fact that they don't provide the file package.xml. Ex: go there http://svn.symfony-project.com/plugins/ check out sfDoctrineCommentsPlugin This looks like a great piece of code. (it's a plugin that adds commentable functionality to any existing model). I didn't try it yet. The problem is it doesn't come up in search results. The title at least should be searchable (ex : to someone searching for "Comments") On Feb 16, 7:30 pm, Pablo Godel wrote: > +1 for voting/rating plus comments on plugins. > > Pablo > > On Mon, Feb 16, 2009 at 5:38 PM, Eno wrote: > > > On Mon, 16 Feb 2009, Martino Piccinato wrote: > > >> I agree here. Sure there are lots of great plugins but hard to find > >> and with lack of coordination. A better site (with voting, improved > >> search/usability/documentation) would be really a great thing. > > > Definately need a voting / rating system. Allowing comments like the PHP > > manual would allow people to highlight problems / 'gotchas', etc. > > > I think plugin developers must document installation and usage more > > thoroughly! > > > -- --~--~-~--~~~---~--~~ 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: Why Doctrine Admin Generator use sfWidgetFormDoctrineSelect on foreign key fields?
just a comment... : I think you should assign the ticket to jwage, since he manages sfDoctrinePlugin Julien On Feb 15, 7:34 pm, Daniele wrote: > I did so! :) > I hope to have done everything > correctly.http://trac.symfony-project.org/ticket/5896 > > On 14 Feb, 22:33, Jonathan Wage wrote: > > > Can you create a ticket for the issue you are having? > > > Thanks, Jon > > > On Sat, Feb 14, 2009 at 12:42 PM, Daniele wrote: > > > > Hi Julien, > > > > I am not talking about N..N relations, but 1..N. > > > As I said above, Propel uses sfWidgetFormPropelChoice on 1..N > > > relations, but Doctrine not. > > > sfWidgetFormORMSelect class do not support expanded option! > > > This is exactly the problem that I have met. > > > > On 13 Feb, 19:13, jukea wrote: > > > > Yes, that's what I was talking about. > > > > > This fix applies to N to N relations. 1 .. N relations still have a > > > > select drop down menu, and I can't see how this is not > > > > appropriate .. ? Would you prefer radio buttons ? then you could use > > > > the 'expanded'=>true option > > > > > Julien > > > > > On Feb 13, 12:55 pm, Daniele wrote: > > > > > > I am not very expert on Trac or SVN, but I do not find anything about > > > > > this. > > > > > I found this that is only similar but not is the same: > > >http://trac.symfony-project.org/ticket/5784 > > > > > > On Feb 12, 11:17 pm, jukea wrote: > > > > > > > Hi, > > > > > > > I think this has been corrected. Look for it in trac, or try > > > > > > 1.2.5dev > > > > > > (trunk) > > > > > > > Julien > > > > > > > On Feb 12, 4:35 pm, Daniele wrote: > > > > > > > > Hi, > > > > > > > someone can help me to understand why my Doctrine admin generator > > > (sf > > > > > > > 1.2.4) creates a sfWidgetFormDoctrineSelect instead of > > > > > > > sfWidgetFormDoctrineChoice on foreign key fields for make the > > > > > > > BaseXXXForm classes? > > > > > > > Instead the validators work as expected, and > > > sfValidatorDoctrineChoice > > > > > > > is used on foreign key fields. > > > > > > > I am moving from Propel to Doctrine and I have noticed this > > > > > > > strangeness, indeed Propel admin generator uses > > > > > > > sfWidgetFormPropelChoice. > > > > > > > Am I doing something wrong or is a normal behaviour? > > > > > > > thanks, Daniele > > > -- > > Jonathan H. Wage > > Open Source Software Developer & > > Evangelisthttp://www.jwage.comhttp://www.doctrine-project.orghttp://www.symfony... --~--~-~--~~~---~--~~ 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: Remove embedded forms / update object runtime
Hi patter, What I'd do is unset the embedded form as if ot was any other field. if($postedValues[..insert your input name...]=='') unset($subForm['embededFormName']) Do this from anywhere before you bind the data. You could also override the bind method in your form, unset the form there, and call the parent method. Julien On Feb 11, 11:06 am, patter wrote: > Hello, > > I have a 1:n relation: User have two phone numbers (well my real use > case is a bit complicated :-) ). > > In my UserForm::configure() I have something like this: > > $p1 = $this->object['phones'][0] = new Phone(); > $p2 = $this->object['phones'][1] = new Phone(); > > $subForm = new sfForm(); > $subForm->embedForm(0, new PhoneForm($p1 ); > $subForm->embedForm(1, new PhoneForm($p2)); > > $this->embedForm('phones', $subForm); > > This works perfect. I can add a new User with 2 phones. > > The problem is that if the user doesn't provide information for second > phone I should not insert a blank record (in fact I can't because of > not null fields). > > I have read a lot of articles but I'm not able to find solution yet. > > I think that I have to use UpdateObject() method to remove unwanted > relation, but if this is the better solution ? > > I use Doctrine :-) --~--~-~--~~~---~--~~ 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: Customizing labels when rendering an sfForm
Hi, just use $form->setLabel('fieldname','This is the label text'); Julien On Feb 14, 2:15 pm, Rytis Daugirdas wrote: > Hello, > > Is it possible to customize field labels when calling > sfForm::render($attributes)? If yes, what is the structure of the > $attributes array I should use? > > Regards, > Rytis --~--~-~--~~~---~--~~ 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: Why Doctrine Admin Generator use sfWidgetFormDoctrineSelect on foreign key fields?
Yes, that's what I was talking about. This fix applies to N to N relations. 1 .. N relations still have a select drop down menu, and I can't see how this is not appropriate .. ? Would you prefer radio buttons ? then you could use the 'expanded'=>true option Julien On Feb 13, 12:55 pm, Daniele wrote: > I am not very expert on Trac or SVN, but I do not find anything about > this. > I found this that is only similar but not is the > same:http://trac.symfony-project.org/ticket/5784 > > On Feb 12, 11:17 pm, jukea wrote: > > > Hi, > > > I think this has been corrected. Look for it in trac, or try 1.2.5dev > > (trunk) > > > Julien > > > On Feb 12, 4:35 pm, Daniele wrote: > > > > Hi, > > > someone can help me to understand why my Doctrine admin generator (sf > > > 1.2.4) creates a sfWidgetFormDoctrineSelect instead of > > > sfWidgetFormDoctrineChoice on foreign key fields for make the > > > BaseXXXForm classes? > > > Instead the validators work as expected, and sfValidatorDoctrineChoice > > > is used on foreign key fields. > > > I am moving from Propel to Doctrine and I have noticed this > > > strangeness, indeed Propel admin generator uses > > > sfWidgetFormPropelChoice. > > > Am I doing something wrong or is a normal behaviour? > > > thanks, Daniele --~--~-~--~~~---~--~~ 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: Why Doctrine Admin Generator use sfWidgetFormDoctrineSelect on foreign key fields?
Hi, I think this has been corrected. Look for it in trac, or try 1.2.5dev (trunk) Julien On Feb 12, 4:35 pm, Daniele wrote: > Hi, > someone can help me to understand why my Doctrine admin generator (sf > 1.2.4) creates a sfWidgetFormDoctrineSelect instead of > sfWidgetFormDoctrineChoice on foreign key fields for make the > BaseXXXForm classes? > Instead the validators work as expected, and sfValidatorDoctrineChoice > is used on foreign key fields. > I am moving from Propel to Doctrine and I have noticed this > strangeness, indeed Propel admin generator uses > sfWidgetFormPropelChoice. > Am I doing something wrong or is a normal behaviour? > thanks, Daniele --~--~-~--~~~---~--~~ 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: sf1.2: sfWidgetFormPropelChoiceMany custom form output
Hi Anton, Here's how I did exactly that in three easy steps ! It's not super clean /optimal / configurable code,but it works. (region_list is the widget name for a 1..n relation in my model) == 1 == I made a static method helper class espUtils { static public function fourColumnsUlformatter($widget, $inputs) { $rows = array(); foreach ($inputs as $input) { $rows[] = ''.$input ['input'].chr(13).$input['label'].''; } return ''.implode(chr(13), $rows).''; } static public function fourColumnsTrformatter($widget, $inputs) { $rows = array(); $cnt=0; foreach ($inputs as $input) { $cnt++; $rows[] = ''.$input['input'].chr (13).$input['label'].''; if($cnt==3) { $res[] = ''.implode(chr(13),$rows).''; $rows=array(); $cnt=0; } } if($cnt) { while($cnt++<3) $rows[] = ''; $res[] = ''.implode(chr(13),$rows).''; } return implode(chr(13),$res); } public static function displayTrChoices($elem,$options=array()) { echo ''; echo ''.(!in_array('no_label',$options)?$elem- >renderLabel():"").$elem->renderError(); echo ''; echo ''; echo $elem; } } 2 = class VisitorContactFormRegistration extends BaseVisitorContactForm { public function configure() { $formatter_tr_option = array('formatter'=>array ('espUtils','fourColumnsTrFormatter')); $this->widgetSchema['regions_list']->setOption('expanded',true); $this->widgetSchema['regions_list']->setOption ('renderer_options',$formatter_tr_option); . 3 = in the View : I thought the espUtils::displayTrChoices pseudo-helper would make this a little more reusable. voilà ! Julien On Feb 11, 3:36 pm, Bob wrote: > I have a form with text fields and hundreds of checkboxes populated > using model "Therapy", like this: > > public function configure() > { > $this->setWidgets(array( > 'therapies' => new sfWidgetFormPropelChoiceMany(array > ('model' => 'Therapy', 'expanded' => true)) > ); > > } > > As somebody said on the forum it is a big pain in the ass to decorate > output of the forms, but nevertheless I have to figure out how to > display all checkboxes in two columns using my custom formatter. > > Is there any way to split hundreds of choices into several arrays, so > I can make a two-column template and put values there manually? > > Thanks, > Anton. --~--~-~--~~~---~--~~ 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: combining sfGuardUserProfile and sfGuardUser in admin backend
check this : http://www.symfony-project.org/blog/2008/11/12/call-the-expert-customizing-sfdoctrineguardplugin On Jan 27, 10:52 pm, vincent wrote: > Is there any way to combine sfGuardUserProfile and sfGuardUser into > one from just to make it easy when adding new user? --~--~-~--~~~---~--~~ 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: Generator: how to do stuff that was possible in 1.1?
> HOW TO ADJUST FILTERS AND HOW TO SET GLOBAL FILTERS? you can adjust filters in the genrator.yml with filters: field1, field2 for global stuff, what I did was something like this : class jobsActions extends autoJobsActions { public function preExecute() { parent::preExecute(); $this->active_date = myUser::getActiveDate(); $this->context->getEventDispatcher()->connect ("admin.build_query", array($this,'addDayViewFilter')); } public function addDayViewFilter($event, $query) { $active_date = myUser::getActiveDate(); return $query->andWhere("start_time LIKE '".$active_date."%' or end_time LIKE '".$active_date."%'") ->andWhere("user_id = ?",$this->getUser()->getId()); } --~--~-~--~~~---~--~~ 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: Displaying an embedded form without nesting it
agree it's not very clean, but thanks for the info. I like this way too. I keeps things fully "automated" On Jan 23, 3:52 pm, isleshocky77 wrote: > Jukea, Thanks for the reply. I was just coming back to say I found a > way of doing it but I don't think it's as clean as I would like. > > [CODE] > class RegistrationForm extends sfGuardUserForm > { > public function configure() { > parent::configure(); > > $profile_form = new > RegistrationProfileForm($this->getObject()->getProfile()); > > $this->embedForm('profile', $profile_form); > $this->getWidget('profile')->setLabel(false); > $this->getWidget('profile')->setFormFormatterName > ('listNoDecorator'); > }} > > [/CODE] > > [CODE] > class sfWidgetFormSchemaFormatterListNoDecorator extends > sfWidgetFormSchemaFormatter > { > protected > $rowFormat = "\n %error%%label%\n %field%%help%\n > %hidden_fields%\n", > $errorRowFormat = "\n%errors%\n", > $helpFormat = '%help%', > $decoratorFormat = "\n %content%"; // Only change is this line > removing the } > > [/CODE] > > [CODE] > // registrationSuccess.php > > > getFormFieldSchema() as $field ) : ?> > getWidget()) == 'sfWidgetForm' || > $field->getWidget() instanceOf sfWidgetFormInputHidden) : ?> > > > renderRow() ?> > > > > > ' ?> > [/CODE] > > Like I said, I really wish there was a cleaner implementation to > this. One I was thinking of was being able to set the "rowDecorator" > on a specific widget > $this->widgetSchema['profile']->setRowFormat("\n %error%%label%\n > %field%%help%\n%hidden_fields%\n"); > notice I removed the > > Any other ideas on a better way to do this would be greatly > appreciated. I'm thinking this has to be a common problem? Or are > most people just solving it through css and I should tell my html/css > coders to deal with it? > > -- > Stephen Ostrow > > On Jan 23, 3:44 pm, jukea wrote: > > > yes, it's because the nested form is rendered as a row itself, with > > the widget being the whole form . > > > I guess you might be able to do that by displaying each embedded form > > row like this > > > $this->embedded_forms['myForm']['embedded_form_username']->renderRow > > (); > > > (check sfFormDoctrine (or propel ) to verify embedded_form, i'm not > > sure) > > > Julien > > > On Jan 23, 2:08 pm, isleshocky77 wrote: > > > > I've run across this problem a few times now. I have a form with an > > > embedded form. But I want it to displayed without being nested within > > > the form. > > > > So instead of: > > > [code] > > > > > > > > > > > > > > > > > > > > > > > > > > > [/code] > > > > I would like just: > > > [code] > > > > > > > > > > > > > > > [/code] > > > > I had tried just doing this: > > > [code] > > > getFormFieldSchema() as $field ) : ?> > > > renderRow() ?> > > > > > > [/code] > > > > but it still nests the form. So I'm thinking I might be able to build > > > a new decorator, but I'm not sure if that will still nest the form. > > > > And I'm trying to stay away from doing every field manually. > > > > Thanks for any help > > > > -- > > > Stephen Ostrow --~--~-~--~~~---~--~~ 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: Displaying an embedded form without nesting it
yes, it's because the nested form is rendered as a row itself, with the widget being the whole form . I guess you might be able to do that by displaying each embedded form row like this $this->embedded_forms['myForm']['embedded_form_username']->renderRow (); (check sfFormDoctrine (or propel ) to verify embedded_form, i'm not sure) Julien On Jan 23, 2:08 pm, isleshocky77 wrote: > I've run across this problem a few times now. I have a form with an > embedded form. But I want it to displayed without being nested within > the form. > > So instead of: > [code] > > > > > > > > > [/code] > > I would like just: > [code] > > > > > [/code] > > I had tried just doing this: > [code] > getFormFieldSchema() as $field ) : ?> > renderRow() ?> > > [/code] > > but it still nests the form. So I'm thinking I might be able to build > a new decorator, but I'm not sure if that will still nest the form. > > And I'm trying to stay away from doing every field manually. > > Thanks for any help > > -- > Stephen Ostrow --~--~-~--~~~---~--~~ 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: Embedding the same form multiple times
oops, I assumed you had some kind of relationship between mines, and the model in the parent form, but from answer I guess you don't have a parent model. On Jan 22, 6:22 pm, juro wrote: > Hmm, not sure which foreign key you are referring to... > > On Jan 23, 1:20 am, jukea wrote: > > > just a quick idea : maybe you forgot to unset the foreign key in the > > MineForm::configuration method ? > > > Julien > > > On Jan 22, 5:52 pm, juro wrote: > > > > Hi, > > > > I am trying to embed the same form (MineForm.class.php) into one form > > > (MinesForm.class.php). Using the embedFormForEach would work, if I > > > need all Mine objects but I want to constrain these by the field > > > 'status'. > > > > This is what the __construst of my MinesForm.class.php looks like: > > > > public function __construct($defaults = array(), $options = array(), > > > $CSRFSecret = null) > > > { > > > parent::__construct($defaults, $options, $CSRFSecret); > > > $objects = Doctrine_Query::create() > > > ->from('Mine m') > > > ->addWhere('m.status = ""') > > > ->limit(20) > > > ->execute(); > > > > foreach ($objects as $object) > > > { > > > // embed the form > > > $this->embedForm('mine_' . $object->getId() , new MineForm > > > ($object)); > > > } > > > } > > > > Unfortunately, this does not work. > > > > Can anyone point me to resources that I can solve this? > > > > juro --~--~-~--~~~---~--~~ 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: Embedding the same form multiple times
just to clarify, this needs to be done , unless your embeded objects will not be linked to the parent. On Jan 22, 5:52 pm, juro wrote: > Hi, > > I am trying to embed the same form (MineForm.class.php) into one form > (MinesForm.class.php). Using the embedFormForEach would work, if I > need all Mine objects but I want to constrain these by the field > 'status'. > > This is what the __construst of my MinesForm.class.php looks like: > > public function __construct($defaults = array(), $options = array(), > $CSRFSecret = null) > { > parent::__construct($defaults, $options, $CSRFSecret); > $objects = Doctrine_Query::create() > ->from('Mine m') > ->addWhere('m.status = ""') > ->limit(20) > ->execute(); > > foreach ($objects as $object) > { > // embed the form > $this->embedForm('mine_' . $object->getId() , new MineForm > ($object)); > } > } > > Unfortunately, this does not work. > > Can anyone point me to resources that I can solve this? > > juro --~--~-~--~~~---~--~~ 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: Embedding the same form multiple times
just a quick idea : maybe you forgot to unset the foreign key in the MineForm::configuration method ? Julien On Jan 22, 5:52 pm, juro wrote: > Hi, > > I am trying to embed the same form (MineForm.class.php) into one form > (MinesForm.class.php). Using the embedFormForEach would work, if I > need all Mine objects but I want to constrain these by the field > 'status'. > > This is what the __construst of my MinesForm.class.php looks like: > > public function __construct($defaults = array(), $options = array(), > $CSRFSecret = null) > { > parent::__construct($defaults, $options, $CSRFSecret); > $objects = Doctrine_Query::create() > ->from('Mine m') > ->addWhere('m.status = ""') > ->limit(20) > ->execute(); > > foreach ($objects as $object) > { > // embed the form > $this->embedForm('mine_' . $object->getId() , new MineForm > ($object)); > } > } > > Unfortunately, this does not work. > > Can anyone point me to resources that I can solve this? > > juro --~--~-~--~~~---~--~~ 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: Attaching global Doctrine listeners in a symfony application
David, That's kind of ugly, but I'd say if you implement an override of processForm, executeDelete and executeBatchDelete for each of your module, that would clear the cache, then call the parent, I think that would cover any type of modification. Julien On Jan 21, 9:36 pm, David Brewer wrote: > Filed a doctrine ticket on this > issue:http://trac.doctrine-project.org/ticket/1847 > > On Wed, Jan 21, 2009 at 6:18 PM, David Brewer wrote: > > Followup #2: > > > I think I've figured out what the hangup is. I added some logging to > > Doctrine_Configurable class where it gets the record listeners... > > > Looks like there is a hierarchy from manager, to connection, to table > > when getting listeners. It stops at the first place it finds > > listeners. So, if you have listeners set directly on the table, it > > won't find listeners in the connection or the manager > > > The reason that some of my listeners were working was not because it > > was a dql-related hook, but because the models I was changing were not > > using the timestampable template. Timestampable applies listeners to > > the table, and that prevents the record from finding system-wide > > listeners. > > > I think this is a bug in Doctrine. I will file a bug about it. In > > the meantime... anyone have an idea for a different place I could > > define a hook that will clear my cache every time a change is made > > using the admin console? :-) > > > On Wed, Jan 21, 2009 at 5:10 PM, David Brewer > > wrote: > >> Followup: it does appear that the record listener I created works so > >> long as I add it directly to a record. So, the super-shortened > >> version of this question is: how can I globally attach a record > >> listener in such a way that it gets executed for every type of record? > > >> On Wed, Jan 21, 2009 at 4:58 PM, David Brewer > >> wrote: > >>> I'm starting to try to wrap my head around using Doctrine listeners in > >>> the context of a symfony application, and I'm encountering some > >>> confusion that I was hoping someone out there might be able to help me > >>> clear up. > > >>> The rough outline of what I'm trying to accomplish is this: the site > >>> in question has a frontend and an admin console. The frontend is > >>> read-only, and I am caching some data using APC. I want to modify the > >>> admin console so that any time a change is made, the APC cache is > >>> cleared. > > >>> The code for clearing the cache is working fine... what I'm struggling > >>> with is the most efficient place to put it so that it automatically > >>> happens for all database changes made via the admin console. I was > >>> hoping that I could accomplish this with a listener so that the cache > >>> clearing code was in one central place. > > >>> So, here's what I'm doing: > > >>> 1. In the configuration for the admin console, I have this: > > >>> public function initialize() { > >>> $manager = Doctrine_Manager::getInstance(); > >>> $manager->setAttribute('use_dql_callbacks', true); > >>> $manager->addRecordListener(new ClearCacheListener()); > >>> } > > >>> 2. ClearCacheListener looks like this: > > >>> class ClearCacheListener extends Doctrine_Record_Listener > >>> { > >>> public function postSave(Doctrine_Event $event) > >>> { > >>> $this->clearCache($event); > >>> } > > >>> // followed by identical implementations of preDqlDelete, > >>> postDelete, preDqlUpdate, postUpdate, postInsert, as well as the > >>> clearCache method > >>> } > > >>> The admin console is using the sf 1.2 admin generator so it makes use > >>> of the form framework, etc. I can see that the listener has been > >>> registered and is kind of working, because the preDqlDelete hook gets > >>> executed whenever I directly delete something using DQL. However, the > >>> other hooks don't seem to fire. Am I misunderstanding what it means > >>> to attach a listener to the manager? I thought that the listener > >>> would fire for matching events on any model. > > >>> Thanks for any clarification on this issue. I'm looking forward to > >>> mastering listeners as I can see that they will be incredibly handy. > > >>> David Brewer --~--~-~--~~~---~--~~ 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: SF.1.2 Admin Generator-Two modules in one
for propel, check this : http://www.symfony-project.org/plugins/sfPropelVersionableBehaviorPlugin On Jan 21, 2:32 pm, Tomasz Ignatiuk wrote: > Yes Symfony 1.2 (as in topic) > OK, thank you, I think this will be the best solution. > > On Jan 21, 8:29 pm, David Brewer wrote: > > > Is this symfony 1.2? If so, you can customize the form for your model > > to handle this. > > > In the configure method for your form, you can add widgets and > > validators for the address-related fields. Then, you can override the > > 'doSave()' method to do custom handling of your extra fields. You'll > > also need to create getters on the Company model that pass through to > > the appropriate version of the Address model in order to populate the > > values on the form. > > > On Wed, Jan 21, 2009 at 11:19 AM, jukea wrote: > > > > You could also use the versionable template if you use doctrine (mabe > > > there's the equivalent for propel, like actAsVersionable or > > > something), which automatially keeps a copy of older versions of the > > > model records when you edit them. > > > > I think that could be a better solution. > > > > Or maybe you could copy the data directly into the invoice ? > > > > Julien > > > > On Jan 21, 1:35 pm, Tomasz Ignatiuk wrote: > > >> Hi, > > >> I have this situations. Two related tables: Company and Company > > >> Address > > >> The idea is to add Company info to Company table and address info > > >> which will be kept in Company Address table. When I change address > > >> info, it will be saved as a new record in Company Address. Because for > > >> example when I look at the Invoice from 1 year ago it will check what > > >> was address etc one year ago (which can be different now) SO the Idea > > >> is to track changeses made in Address table. > > > >> My question is: what is the best way to put Company Address fields > > >> into NEW and EDIT in Company module, all generate by admin generator? > > >> My idea was to add partial fields and to change actions of Company > > >> Address module in order to save data as new record each time if > > >> something was changed in it. > > > >> Do you think there is a better solution? --~--~-~--~~~---~--~~ 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: SF.1.2 Admin Generator-Two modules in one
You could also use the versionable template if you use doctrine (mabe there's the equivalent for propel, like actAsVersionable or something), which automatially keeps a copy of older versions of the model records when you edit them. I think that could be a better solution. Or maybe you could copy the data directly into the invoice ? Julien On Jan 21, 1:35 pm, Tomasz Ignatiuk wrote: > Hi, > I have this situations. Two related tables: Company and Company > Address > The idea is to add Company info to Company table and address info > which will be kept in Company Address table. When I change address > info, it will be saved as a new record in Company Address. Because for > example when I look at the Invoice from 1 year ago it will check what > was address etc one year ago (which can be different now) SO the Idea > is to track changeses made in Address table. > > My question is: what is the best way to put Company Address fields > into NEW and EDIT in Company module, all generate by admin generator? > My idea was to add partial fields and to change actions of Company > Address module in order to save data as new record each time if > something was changed in it. > > Do you think there is a better solution? --~--~-~--~~~---~--~~ 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: Sf 1.2 functional tests harness fails
Hi I had this problem too, and found why by running the individual failling test e.g : php /test/function/FooTest.php The problem was that I had to raise the memory_limit from 32MB to something greater (i.e : 128). Julien On Jan 21, 10:37 am, Jérôme TEXIER wrote: > Hi, > > I've got a problem running every functional tests of an application > > ex: symfony test:functional frontend > > returns me for each test a "dubious" flag and a "Test returned status > 255" message > although all of those tests work individually. > > I can't figure out what really fails because frontend_test.log remains > empty, looking like no test were running at all. > I precise I don't have the same problem with unit test where tests > harness is working well. > > My config : > symfony version 1.2.2 > PHP 5.2.6-5 with Suhosin-Patch 0.9.6.2 (cli) > on debian etch, kernel 2.6.18-6-486 > > Any ideas ? > Regards. > > Jérôme --~--~-~--~~~---~--~~ 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: Embeded forms : create a company and the 1st contacts in a single operation
I found the solution , I just needed to unset the embedded form's foreign_key field in the configure method: unset($form_company['company_id']); On Jan 16, 6:16 pm, jukea wrote: > for anyone looking for the same kind of info, look at > > http://trac.symfony-project.org/ticket/4906 > at the end, there's an example > > On Jan 15, 2:17 pm, jukea wrote: > > > Hi , > > > How can I configure a form to handle the creation of a company and the > > first of its contacts (the relation is a 1..n ) > > > I did the following, but the contact's company_id is NULL after a > > save. The contact form has no special configuration (except unsetting > > created_at and updated_at) > > > public function configure() > > { > > $form_contact = new CompanyContactFormRegistration($this->getObject > > ()->Contacts[0]); > > > $this->embedForm('contact', $form_contact); > > } > > > thanks! > > Julien --~--~-~--~~~---~--~~ 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: Embeded forms : create a company and the 1st contacts in a single operation
for anyone looking for the same kind of info, look at http://trac.symfony-project.org/ticket/4906 at the end, there's an example On Jan 15, 2:17 pm, jukea wrote: > Hi , > > How can I configure a form to handle the creation of a company and the > first of its contacts (the relation is a 1..n ) > > I did the following, but the contact's company_id is NULL after a > save. The contact form has no special configuration (except unsetting > created_at and updated_at) > > public function configure() > { > $form_contact = new CompanyContactFormRegistration($this->getObject > ()->Contacts[0]); > > $this->embedForm('contact', $form_contact); > } > > thanks! > Julien --~--~-~--~~~---~--~~ 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: Introducing swDoctrineAssetsLibraryPlugin
just a quick comment : the plugin doesn't come up (as for many other I guess, why is that ?) when you check 1.2 and doctrine in the search engine. Julien On Jan 16, 3:37 am, "Thomas Rabaix" wrote: > Hello, > > I took some time to publish some work I have done on sfAssetsLibraryPlugin a > few month ago. I have converted the plugin to works with Doctrine and sf1.1 > (and sf1.2). > > Yesterday night I have committed the code under the plugin named > 'swDoctrineAssetsLibraryPlugin' > and migrate to sf1.2. So the sf1.2 version might be less stable and both > version might have some > issue with naming reference (pointing to sfAssetsLibraryPlugin). > > Alpha versions are available on svn > > - sf1.1 : > http://svn.symfony-project.com/plugins/swDoctrineAssetsLibraryPlugin/... > - sf1.2 : > http://svn.symfony-project.com/plugins/swDoctrineAssetsLibraryPlugin/... > > You have to install swToolboxPlugin in order to use the plugin > > - sf1.1 : > http://svn.symfony-project.com/plugins/swToolboxPlugin/sf1.1/trunk > - sf1.2 : > http://svn.symfony-project.com/plugins/swToolboxPlugin/sf1.2/trunk > > You are very welcome to open tickets and write patches for any issue you > might have ! > > -- > Thomas Rabaix > Internet Consultant --~--~-~--~~~---~--~~ 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] Embeded forms : create a company and the 1st contacts in a single operation
Hi , How can I configure a form to handle the creation of a company and the first of its contacts (the relation is a 1..n ) I did the following, but the contact's company_id is NULL after a save. The contact form has no special configuration (except unsetting created_at and updated_at) public function configure() { $form_contact = new CompanyContactFormRegistration($this->getObject ()->Contacts[0]); $this->embedForm('contact', $form_contact); } thanks! Julien --~--~-~--~~~---~--~~ 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: Admin generator filters in sf 1.2
Here are two strategies I used to do something similar (my ORM is doctrine) : 1) I needed to filter the query based on a date stored in the session, and the user_id, without these being in the filter form. in your module's action file, override preExecute to add a listener public function preExecute() { parent::preExecute(); $this->context->getEventDispatcher()->connect("admin.build_query", array($this,'addDayViewFilter')); } public function addDayViewFilter($event, $query) { $active_date = $this->getActiveDate(); return $query->andWhere("start_time LIKE '".$active_date."%' or end_time LIKE '".$active_date."%'") ->andWhere("user_id = ?",$this->getUser()->getId()); } 2) I needed to add a field in a foreign table to my filter form (2 tables away to my model, relation-wise ): i) add the widget + validator to the form ii) merge the field with what getFields returns (note that the type specified has no effect since the method is override by us anyway (see iii) iii) add the method "addFIELDNAMEColumnQuery" . sfFormFilterDoctrine looks for a method like this when it finds a fields that's not in the model, be it virtual or foreign Note that the join is done in the addClientIdColumnQuery method. This is not a clean way of doing : this join should be done with a method specified to the form filter. (e.g: use table_method in the generator.yml, if you're using a generated admin, like the peer_method for propel) I submitted a ticket + patch (see http://trac.symfony-project.org/ticket/5586 ) that would let you do something like $myFormFilter->setTableMethod ($table_method_name), so the joins are done from the beginning of the query building process. This is my filter form class : class JobFormFilter extends BaseJobFormFilter { public function configure() { $this->widgetSchema['client_id'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'expanded' => true, 'model' => 'Client')); $this->validatorSchema['client_id'] = new sfValidatorPass(); <-- this is not right , I know :) } public function getFields() { return array_merge(parent::getFields(),array('client_id' => 'ForeignKey')); <--- ForeignKey has no effect since the method used is our own. See below } protected function addClientIdColumnQuery(Doctrine_Query $query, $field, $value) { $query->leftJoin('r.Project p') ->leftJoin('p.Client c') ->orWhereIn('p.client_id', $value); } } --~--~-~--~~~---~--~~ 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 admin : sorting and filtering are done before table_method makes joined tables available for query building
Jon, I sumbmitted a patch to the ticket, which passed all tests included with sfDoctrinePlugin. see it here : http://trac.symfony-project.org/ticket/5586 Julien On Jan 13, 2:53 pm, Jonathan Wage wrote: > You can run the tests included with the sfDoctrinePlugin in the test folder. > > - Jon > > > > On Tue, Jan 13, 2009 at 1:45 PM, jukea wrote: > > > Also , if I patch the admin code templates, is there any test I should > > code, before submitting a patch ? I found none for the generated > > admins > > > Julien > > > On Jan 13, 2:29 pm, jukea wrote: > > > Jon, > > > > I think the filter forms should get passed the table_method with a > > > setTableMethod, if any, in the same way the pager does. > > > > eg : > > > > $filterForm->setTableMethod() > > > > if there's no filter, then we'd still need to do it before the sorting > > > criteria is added: > > > > $query=Doctrine::getTable('getModelClass() ?>')-> > > > $table_method($query); > > > > So in generated admins, the pager would not be passed the > > > table_method anymore, since it would always be applied to the query > > > before it receives it. > > > > To sum it up : > > > > 1) add a setTableMethod to sfDoctrinFilterForm > > > 2) change the action template to use it as described above > > > > What's the best way I can help ? Submit a patch ? > > > > Julien > > > > On Jan 13, 2:11 pm, Jonathan Wage wrote: > > > > > Could we just change it so table_method is done first? > > > > > - Jon > > > > > On Tue, Jan 13, 2009 at 12:48 PM, jukea wrote: > > > > > > Just to add more information on that matter : > > > > > > For the sorting feature to work, what I did was move the use of the > > > > > table_method just before the sorting part is added (directly in the > > > > > actions code template) > > > > > > protected function addSortQuery($query) > > > > > { > > > > > if (array(null, null) == ($sort = $this->getSort())) > > > > > { > > > > > return; > > > > > } > > > > > $table_method=$this->configuration->getTableMethod(); > > > > > $query=Doctrine::getTable('getModelClass() > > ?>')-> > > > > > $table_method($query); > > > > > > $query->addOrderBy($sort[0] . ' ' . $sort[1]); > > > > > } > > > > > > and then comment the setTableMethod to the pager, since it's already > > > > > been applied to the query. > > > > > > This means requiring to fork the admin theme just to make these > > > > > changes, which is really not the best design. > > > > > > On Jan 13, 1:42 pm, jukea wrote: > > > > > > Hi, > > > > > > > I'm building a plugin to make fields of foreign tables available to > > > > > > lists (in doctrine generated admins) as any other parameter, so > > that > > > > > > sorting (this is > > > > > > working) & filtering on them is possible. > > > > > > > Here's an example of an "extended" generator.yml my plugin would > > make > > > > > > possible : (for a schema as > > > > > > such : [User] 11 [Profile] 1.n [Phonenumbers] ) > > > > > > > config: > > > > > > fields: > > > > > > p.name: {label: name, path: Profile} > > > > > > n.number {label: phone number, path: Profile.PhoneNumbers} > > > > > > > list: > > > > > > table_method: someMethodThatJoinsProfileAndPhoneNumbers > > > > > > display : field1, field2, p.name > > > > > > filter: > > > > > > display: field1, field2, n.number > > > > > > > So the requirements are that > > > > > > > 1) you have to name the foreign fields prefixed by their table > > alias > > > > > > > 2) you have to specify the path to the table they're located into. > > > > > > e.g : enumeration of tables along the path except the root table, > > > > > > separated by a dot > > > > > > > In the actual implementation of symfony/doctrine admin lists , the > > > > > > query is built
[symfony-users] Re: Doctrine admin : sorting and filtering are done before table_method makes joined tables available for query building
Also , if I patch the admin code templates, is there any test I should code, before submitting a patch ? I found none for the generated admins Julien On Jan 13, 2:29 pm, jukea wrote: > Jon, > > I think the filter forms should get passed the table_method with a > setTableMethod, if any, in the same way the pager does. > > eg : > > $filterForm->setTableMethod() > > if there's no filter, then we'd still need to do it before the sorting > criteria is added: > > $query=Doctrine::getTable('getModelClass() ?>')-> > $table_method($query); > > So in generated admins, the pager would not be passed the > table_method anymore, since it would always be applied to the query > before it receives it. > > To sum it up : > > 1) add a setTableMethod to sfDoctrinFilterForm > 2) change the action template to use it as described above > > What's the best way I can help ? Submit a patch ? > > Julien > > On Jan 13, 2:11 pm, Jonathan Wage wrote: > > > Could we just change it so table_method is done first? > > > - Jon > > > On Tue, Jan 13, 2009 at 12:48 PM, jukea wrote: > > > > Just to add more information on that matter : > > > > For the sorting feature to work, what I did was move the use of the > > > table_method just before the sorting part is added (directly in the > > > actions code template) > > > > protected function addSortQuery($query) > > > { > > > if (array(null, null) == ($sort = $this->getSort())) > > > { > > > return; > > > } > > > $table_method=$this->configuration->getTableMethod(); > > > $query=Doctrine::getTable('getModelClass() ?>')-> > > > $table_method($query); > > > > $query->addOrderBy($sort[0] . ' ' . $sort[1]); > > > } > > > > and then comment the setTableMethod to the pager, since it's already > > > been applied to the query. > > > > This means requiring to fork the admin theme just to make these > > > changes, which is really not the best design. > > > > On Jan 13, 1:42 pm, jukea wrote: > > > > Hi, > > > > > I'm building a plugin to make fields of foreign tables available to > > > > lists (in doctrine generated admins) as any other parameter, so that > > > > sorting (this is > > > > working) & filtering on them is possible. > > > > > Here's an example of an "extended" generator.yml my plugin would make > > > > possible : (for a schema as > > > > such : [User] 11 [Profile] 1.n [Phonenumbers] ) > > > > > config: > > > > fields: > > > > p.name: {label: name, path: Profile} > > > > n.number {label: phone number, path: Profile.PhoneNumbers} > > > > > list: > > > > table_method: someMethodThatJoinsProfileAndPhoneNumbers > > > > display : field1, field2, p.name > > > > filter: > > > > display: field1, field2, n.number > > > > > So the requirements are that > > > > > 1) you have to name the foreign fields prefixed by their table alias > > > > > 2) you have to specify the path to the table they're located into. > > > > e.g : enumeration of tables along the path except the root table, > > > > separated by a dot > > > > > In the actual implementation of symfony/doctrine admin lists , the > > > > query is built like this : > > > > > 1) the filter form initiates the query and adds filtering parts > > > > 2) back into the controller, the sorting part is added > > > > 3) the pager gets passed the query > > > > 4) the pager applies table_method > > > > > As the title suggests, the problem is that the code adding the sorting > > > > and the filtering part is done before table_method is used, so they're > > > > not given access to the joined table fields > > > > > I created the following ticket that describes the problem : > > >http://trac.symfony-project.org/ticket/5586 > > > > > Also, table_method is local to the list context, which is a problem, > > > > because the filter would need it too. > > > > > My solution is : I developped a new theme for the filter form > > > > generator in which BaseFormFilterDoctrine overrides buildQuery so that > > > > it gets passed the table_method, if any, and applies it right after > > > > creating the query, so tables are joind from at the beginning. > > > > > I feel all this might be hacky, so my question is : in the long term, > > > > what would be the right way of doing that ? > > > > > * Bonus question : how can I make my new form filter theme active for > > > > the admin generation ? > > > > > thanks for your help! > > > -- > > Jonathan H. Wage > > Open Source Software Developer & > > Evangelisthttp://www.jwage.comhttp://www.doctrine-project.orghttp://www.symfony... --~--~-~--~~~---~--~~ 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 admin : sorting and filtering are done before table_method makes joined tables available for query building
Jon, I think the filter forms should get passed the table_method with a setTableMethod, if any, in the same way the pager does. eg : $filterForm->setTableMethod() if there's no filter, then we'd still need to do it before the sorting criteria is added: $query=Doctrine::getTable('getModelClass() ?>')-> $table_method($query); So in generated admins, the pager would not be passed the table_method anymore, since it would always be applied to the query before it receives it. To sum it up : 1) add a setTableMethod to sfDoctrinFilterForm 2) change the action template to use it as described above What's the best way I can help ? Submit a patch ? Julien On Jan 13, 2:11 pm, Jonathan Wage wrote: > Could we just change it so table_method is done first? > > - Jon > > > > On Tue, Jan 13, 2009 at 12:48 PM, jukea wrote: > > > Just to add more information on that matter : > > > For the sorting feature to work, what I did was move the use of the > > table_method just before the sorting part is added (directly in the > > actions code template) > > > protected function addSortQuery($query) > > { > > if (array(null, null) == ($sort = $this->getSort())) > > { > > return; > > } > > $table_method=$this->configuration->getTableMethod(); > > $query=Doctrine::getTable('getModelClass() ?>')-> > > $table_method($query); > > > $query->addOrderBy($sort[0] . ' ' . $sort[1]); > > } > > > and then comment the setTableMethod to the pager, since it's already > > been applied to the query. > > > This means requiring to fork the admin theme just to make these > > changes, which is really not the best design. > > > On Jan 13, 1:42 pm, jukea wrote: > > > Hi, > > > > I'm building a plugin to make fields of foreign tables available to > > > lists (in doctrine generated admins) as any other parameter, so that > > > sorting (this is > > > working) & filtering on them is possible. > > > > Here's an example of an "extended" generator.yml my plugin would make > > > possible : (for a schema as > > > such : [User] 11 [Profile] 1.n [Phonenumbers] ) > > > > config: > > > fields: > > > p.name: {label: name, path: Profile} > > > n.number {label: phone number, path: Profile.PhoneNumbers} > > > > list: > > > table_method: someMethodThatJoinsProfileAndPhoneNumbers > > > display : field1, field2, p.name > > > filter: > > > display: field1, field2, n.number > > > > So the requirements are that > > > > 1) you have to name the foreign fields prefixed by their table alias > > > > 2) you have to specify the path to the table they're located into. > > > e.g : enumeration of tables along the path except the root table, > > > separated by a dot > > > > In the actual implementation of symfony/doctrine admin lists , the > > > query is built like this : > > > > 1) the filter form initiates the query and adds filtering parts > > > 2) back into the controller, the sorting part is added > > > 3) the pager gets passed the query > > > 4) the pager applies table_method > > > > As the title suggests, the problem is that the code adding the sorting > > > and the filtering part is done before table_method is used, so they're > > > not given access to the joined table fields > > > > I created the following ticket that describes the problem : > >http://trac.symfony-project.org/ticket/5586 > > > > Also, table_method is local to the list context, which is a problem, > > > because the filter would need it too. > > > > My solution is : I developped a new theme for the filter form > > > generator in which BaseFormFilterDoctrine overrides buildQuery so that > > > it gets passed the table_method, if any, and applies it right after > > > creating the query, so tables are joind from at the beginning. > > > > I feel all this might be hacky, so my question is : in the long term, > > > what would be the right way of doing that ? > > > > * Bonus question : how can I make my new form filter theme active for > > > the admin generation ? > > > > thanks for your help! > > -- > Jonathan H. Wage > Open Source Software Developer & > Evangelisthttp://www.jwage.comhttp://www.doctrine-project.orghttp://www.symfony-project.org --~--~-~--~~~---~--~~ 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 admin : sorting and filtering are done before table_method makes joined tables available for query building
Just to add more information on that matter : For the sorting feature to work, what I did was move the use of the table_method just before the sorting part is added (directly in the actions code template) protected function addSortQuery($query) { if (array(null, null) == ($sort = $this->getSort())) { return; } $table_method=$this->configuration->getTableMethod(); $query=Doctrine::getTable('getModelClass() ?>')-> $table_method($query); $query->addOrderBy($sort[0] . ' ' . $sort[1]); } and then comment the setTableMethod to the pager, since it's already been applied to the query. This means requiring to fork the admin theme just to make these changes, which is really not the best design. On Jan 13, 1:42 pm, jukea wrote: > Hi, > > I'm building a plugin to make fields of foreign tables available to > lists (in doctrine generated admins) as any other parameter, so that > sorting (this is > working) & filtering on them is possible. > > Here's an example of an "extended" generator.yml my plugin would make > possible : (for a schema as > such : [User] 11 [Profile] 1.n [Phonenumbers] ) > > config: > fields: > p.name: {label: name, path: Profile} > n.number {label: phone number, path: Profile.PhoneNumbers} > > list: > table_method: someMethodThatJoinsProfileAndPhoneNumbers > display : field1, field2, p.name > filter: > display: field1, field2, n.number > > So the requirements are that > > 1) you have to name the foreign fields prefixed by their table alias > > 2) you have to specify the path to the table they're located into. > e.g : enumeration of tables along the path except the root table, > separated by a dot > > In the actual implementation of symfony/doctrine admin lists , the > query is built like this : > > 1) the filter form initiates the query and adds filtering parts > 2) back into the controller, the sorting part is added > 3) the pager gets passed the query > 4) the pager applies table_method > > As the title suggests, the problem is that the code adding the sorting > and the filtering part is done before table_method is used, so they're > not given access to the joined table fields > > I created the following ticket that describes the problem > :http://trac.symfony-project.org/ticket/5586 > > Also, table_method is local to the list context, which is a problem, > because the filter would need it too. > > My solution is : I developped a new theme for the filter form > generator in which BaseFormFilterDoctrine overrides buildQuery so that > it gets passed the table_method, if any, and applies it right after > creating the query, so tables are joind from at the beginning. > > I feel all this might be hacky, so my question is : in the long term, > what would be the right way of doing that ? > > * Bonus question : how can I make my new form filter theme active for > the admin generation ? > > thanks for your help! --~--~-~--~~~---~--~~ 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] Doctrine admin : sorting and filtering are done before table_method makes joined tables available for query building
Hi, I'm building a plugin to make fields of foreign tables available to lists (in doctrine generated admins) as any other parameter, so that sorting (this is working) & filtering on them is possible. Here's an example of an "extended" generator.yml my plugin would make possible : (for a schema as such : [User] 11 [Profile] 1.n [Phonenumbers] ) config: fields: p.name: {label: name, path: Profile} n.number {label: phone number, path: Profile.PhoneNumbers} list: table_method: someMethodThatJoinsProfileAndPhoneNumbers display : field1, field2, p.name filter: display: field1, field2, n.number So the requirements are that 1) you have to name the foreign fields prefixed by their table alias 2) you have to specify the path to the table they're located into. e.g : enumeration of tables along the path except the root table, separated by a dot In the actual implementation of symfony/doctrine admin lists , the query is built like this : 1) the filter form initiates the query and adds filtering parts 2) back into the controller, the sorting part is added 3) the pager gets passed the query 4) the pager applies table_method As the title suggests, the problem is that the code adding the sorting and the filtering part is done before table_method is used, so they're not given access to the joined table fields I created the following ticket that describes the problem : http://trac.symfony-project.org/ticket/5586 Also, table_method is local to the list context, which is a problem, because the filter would need it too. My solution is : I developped a new theme for the filter form generator in which BaseFormFilterDoctrine overrides buildQuery so that it gets passed the table_method, if any, and applies it right after creating the query, so tables are joind from at the beginning. I feel all this might be hacky, so my question is : in the long term, what would be the right way of doing that ? * Bonus question : how can I make my new form filter theme active for the admin generation ? thanks for your help! --~--~-~--~~~---~--~~ 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: Using a form filter without the admin generator
My answer is for doctrine, but I think it should also apply to propel. The way it is built, I think you need to initiate the database query using them (e.g. : $query = $yourFilterForm->buildQuery ()). And then you can add your stuff (like sorting, joining addintionnal tables etc) Anyway, the best is to generated an admin, and look at cache/backend/ dev/yourAdminModuleName/actions/actions.class.php ( or something like this) More specifically, look at executeFilter, which updates the filter parameters in the session (a good strategy in my opinion). And also buildQuery. A filter is a lot like a normal form, with the added ability to start a query with the filters already applied to it (i.e : the where clauses) Julien On Jan 13, 11:56 am, rené wrote: > Hello, > > I am trying to use a form filter without the admin generator to filter > some results from a default index action. > How can I include such a form in a template? > If I understand correctly, symfony propel:build-all already created > these form in lib/filter. Unfortunately I didn't find any info in the > documentation on how I can integrate these. They just seem to appear > in the context of the admin generator, as > inhttp://www.symfony-project.org/jobeet/1_2/Propel/en/12for example. > > Thanks for any ideas, > > René --~--~-~--~~~---~--~~ 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] Setting the label for fields inside a i18n embedded form
Hi, Is there a way to modify the labels of a i18n embedded form (Ideally, by using directly the generator.yml file)? ex : DB: my_fieldname1 : VARCHAR my_fieldname2 : VARCHAR FORM : English: my_customized_fieldname1 [ ] my_customized_fieldname2 [ ] French: my_customized_fieldname1 [ ] my_customized_fieldname2 [ ] Thanks! --~--~-~--~~~---~--~~ 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: spawn process which outlives request, to avoid timeouts
I read very quickly, but did you look into php's set_time_limit ? On Sep 24, 3:48 pm, Jack Bates <[EMAIL PROTECTED]> wrote: > I am using symfony to develop a web interface which runs certain jobs > (deploying sites to a shared host, updating deployed sites, etc.) > > The trouble is that these jobs can take up to 30 minutes to run, so I > am naturally encountering timeout problems, not to mention what > happens if the user quits the browser, or the HTTP connection closes. > > Currently I am using a simple symfony action which performs the job > and sends output to the browser when done. I think what I need to do, > is spawn a new process which outlives the web request. This will avoid > timeouts because the web request will complete almost immediately, but > the spawned process will continue to run the job up to 30 minutes. > Ideally, the spawned process would also update a database with the > status of the job as it runs. This would enable me to display progress > to the user, perhaps using Ajax to periodically poll the database, > even if the user quit the browser and then returned to my web > application. The web application could use the database to inform the > user how much of the job had been completed, and perhaps use the PID > to check that it was still running. > > Does anyone have any input? Is this a viable solution? Are there any > facilities for this in symfony? How do I spawn a process which > outlives the web request, but is able to communicate with subsequent > web requests using the database? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony clear-cache locking the CLI environment ?
For my part, I manage to bypass the problem by erasing cache/* manually and symfony cc _seems_ to work (if there's anything left to be done after that) On Sep 19, 5:23 am, "Nicolas Perriault" <[EMAIL PROTECTED]> wrote: > On Fri, Sep 19, 2008 at 2:07 AM, Cristiano <[EMAIL PROTECTED]> wrote: > > I had a quick back and forward between symfony 1.1.1 and 1.1.2 and it > > is definitely a 1.1.2 issue. Trying to figure out at the moment what > > line is causing the issue. I made a diff of the changes between 1.1.1 > > and 1.1.2 in the /lib/task/cache/sfCacheClearTask.class.php file but > > can't figure out what is causing it yet. > > People, can you open a ticket on this issue, specifing your OS, php > version and sample use cases? > > Thanks :-) > > ++ > > -- > Nicolas > Perriaulthttp://prendreuncafe.com-http://symfonians.net-http://sensiolabs.com > Phone: +33 660 92 08 67 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Symfony clear-cache locking the CLI environment ?
hi, symfony cc locks each environement before clearing the files. For me, the task seemed broken. So, after tracking the bug, it turns out that my symfony cc locks the CLI env too (is this normal?), and thus quits with an unavailable page outputed directly in the console... so in other terms, it locks itself in ! anyone has any idea why ? jk --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Peer method not found class... with sfDoctrinePlugin
I have the same problem here. On Sep 16, 10:05 am, Martin Groh <[EMAIL PROTECTED]> wrote: > Hi there, > > Im using sf 1.1.1 together with the sfDoctrinePlugin 2.0 (checked out > with svn:externals). > Yesterday everything went well. After doing an update for my sources > (and with it, updating the svn:externals), I get an "Peer method not > found for class..." Error, everytime I access an modelelement with an > relationship. > Has anyone else run into this? Yesterday everything worked fine. Are > there any peer classes and methods in doctrine?? > > Thanks for a hint, > Martin --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Debugging site on the prod server
A bad thing indeed, but... In a perfect world, you would test on the development server, and deploy on the prod server when your code is bug free. However, for various reasons (ie: error while manually syncing the prod tables with dev) , you sometimes have a working site on dev and a blank page , or internal server error on prod, which is really a hassle, because you're out in the wild without your debug toolbar... So my question is : what do you usually check / do when prod is broken ? for example : - Without display_errors=1 (I think that's the case on most prod servers) a bad DB connection causes a fatal error, hence a blank page, so that's one of the things I'd check first. - Enable symfony logs, and check them - Some people upload the dev controller to have more info, ( and yes, they usually repent after telling me so ..! ) jukea --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---