[symfony-users] Re: Propel route: new object with foreign key (sf 1.3.7)
On 4 Ott, 18:53, Christian alice...@googlemail.com wrote: So, i have to create a new route and modify the executeNew action? Is there no way to use the default @offer_refurbishment_new route? You can use the default route, just pass any added parameter as query string. E.g.: @offer_refurbishment_new?offer_id=1 cheers Massimiliano -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Propel route: new object with foreign key (sf 1.3.7)
hmm, doesnt work. link_to(add refurbishment, '@offer_refurbishment_new?offer_id='. $offer-getId()) generates: http://domain.tld/backoffice_dev.php/offer_refurbishment/new.html why? any idea? On 5 Okt., 15:17, Massimiliano Arione garak...@gmail.com wrote: On 4 Ott, 18:53, Christian alice...@googlemail.com wrote: So, i have to create a new route and modify the executeNew action? Is there no way to use the default @offer_refurbishment_new route? You can use the default route, just pass any added parameter as query string. E.g.: �...@offer_refurbishment_new?offer_id=1 cheers Massimiliano -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: Propel route: new object with foreign key (sf 1.3.7)
Nope, that won't work because the named route doesn't take or expect a real parameter and you're providing it your offer_id. Try this: link_to(add refurbishment, '@offer_refurbishment_new', array('query_string' = 'offer_id='.$offer-getId())) But you'd be much better served if you just redefined the offer_refurbishment_new route like this: offer_refurbishment_new: url: /offer_refurbishment/new/:offer_id.:sf_format class: sfPropelRoute options: { model: OfferRefurbishment, type: object } param: { module: offer_refurbishment, action: new, sf_format: html } requirements: { sf_method: get, offer_id: '\d+' } Add this rule below your PropelRouteCollection rule for offer_refurbishment. Please check if the model I put up there is correct. Having done this, you can use this: link_to(add refurbishment, '@offer_refurbishment_new?offer_id='.$offer-getId()) Cheers, Daniel On 05.10.2010, at 16:32, Christian wrote: link_to(add refurbishment, '@offer_refurbishment_new?offer_id='. $offer-getId()) -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
[symfony-users] Re: Propel route: new object with foreign key (sf 1.3.7)
In the new action for the related object, just stick that ID into the object or set it as default for the form. $object = new Whatever(); $object - setRelatedId($request - getParameter(offer_id)); $form = new WhateverForm($object); //OR $form = new WhateverForm(new Whatever()); $form - setDefault(offer_id, $request - getParameter(offer_id)); Daniel On Oct 4, 3:32 am, Christian Hoffart hoff...@thesisdigital.de wrote: Hi, if want to create new object throught propel route. eg: link_to(add refurbishment, '@offer_refurbishment_new') the new offer_refurbishment object has a referenced offer object (foreign key offer_id). in the new (edit) form there is a hidden field with name offer_id. how can a set this foreign key (hidden field) with correct offer_id throught propel route like link_to(add refurbishment, '@offer_refurbishment_new?offer_id='. $offer-getId())? I have to rewrite the propel route? thanks Christian PS: sorry for my bad english -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en
Re: [symfony-users] Re: Propel route: new object with foreign key (sf 1.3.7)
So, i have to create a new route and modify the executeNew action? Is there no way to use the default @offer_refurbishment_new route? Am 04.10.2010 18:27, schrieb Richtermeister: In the new action for the related object, just stick that ID into the object or set it as default for the form. $object = new Whatever(); $object - setRelatedId($request - getParameter(offer_id)); $form = new WhateverForm($object); //OR $form = new WhateverForm(new Whatever()); $form - setDefault(offer_id, $request - getParameter(offer_id)); Daniel On Oct 4, 3:32 am, Christian Hoffarthoff...@thesisdigital.de wrote: Hi, if want to create new object throught propel route. eg: link_to(add refurbishment, '@offer_refurbishment_new') the new offer_refurbishment object has a referenced offer object (foreign key offer_id). in the new (edit) form there is a hidden field with name offer_id. how can a set this foreign key (hidden field) with correct offer_id throught propel route like link_to(add refurbishment, '@offer_refurbishment_new?offer_id='. $offer-getId())? I have to rewrite the propel route? thanks Christian PS: sorry for my bad english -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en