[symfony-users] Re: where do most Symfony developers resize images, in the Form class, or in a validator?
I will create a class that handle that, and passing some parameters I will do the resize/crop there. In this way you can reuse the code say from a batch script or the backend, etc. On Sep 3, 2009, at 1:35 PM, Jake Barnes wrote: I've a form that allows users to upload images that can represent them on the site. I need to crop and resize the images to be sure they are all the same size. I am curious where do most Symfony developers put their code for resizing images? In the form class? I assume it is bad practice to do this in the action? --~--~-~--~~~---~--~~ 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] how to get the module name bu giving a route name
Hello all, I have the route name and I want to get the module name of the route. just wondering what could be the way to find it! for example: Zip: url: home/:zip param: { module: home, action: results } so, I have the route name Zip and I want to get the module name which is home in this case.. I loaded the whole routing.yml file then parsed it to find the module name which works but I am sure there must be a better, efficient way to do it.. Please 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: Primary Key Forgery Attack?
Would you share your solution? I would suspect one way to go about doing it is keeping the current ID in the session (as a flash variable) and comparing it upon post. On Sep 2, 7:03 pm, Jeremy Thomerson jeremythomer...@gmail.com wrote: Yeah - but it's better to have both kinds of security. The validation that the same ID is coming back in is simple and can be generically added to all Propel forms from a single place. That makes securing it with business logic easier, because you don't have to worry about invalid IDs. I implemented the ID forge protection in my BasePropelForm last night and it works great, so now I have both that and the security of verifying that the record being edited is allowed to be edited by the authenticated user. It just seems like this is something that would be built in - just like CSRF protection. It's a basic web attack strategy that could (and I think should) easily be defended against by the framework - making it that much better for the user. And it's not difficult - it only took me a couple hours to create it. Jeremy Thomerson On Wed, Sep 2, 2009 at 3:10 AM, Sid Bachtiar sid.bacht...@gmail.com wrote: Hi Jeremy, Those Symfony / Propel generated forms are basic with no security. You will need to secure them based on the requirements of your project. You don't secure a record from unauthorized access by obscuring the ID, you actually have to check to make sure that a user is allowed to access particular record when they try to. Sid On Wed, Sep 2, 2009 at 5:55 PM, Jeremy Thomersonjeremythomer...@gmail.com wrote: I have a question. In Symfony / Propel forms, when I am editing an object, the primary key is a hidden field. I have verified that by using Tamper Data (or anything of the nature), I can modify a different row in the database (iow, someone else's information) by simply changing the ID value in the HTTP submission. This is very bad default behavior. Is there a way to turn this off? I have come up with a way to overcome it - similar to the CSRF protection. But I've hit one snag. Here's the thought: 1 - In BasePropelForm __construct, I add a field to the form that has a hash of the form class, the primary key value, and some secret internal salt (other things could be added). 2 - I add a validator to the primary key field of the form that verifies that the value that comes in on submission also hashes out to the hash that was in the form. This works in my tests. The only snag is that I can't find an automated way of getting the primary key field name. Is there a way? Thanks, Jeremy Thomerson --~--~-~--~~~---~--~~ 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: sfForm-save() for an update
Using both solutions getting following error.. Cannot insert a value for auto-increment primary key [Profile.ID] :( On Mon, Aug 31, 2009 at 6:00 PM, Alexandre SALOME alexandre.sal...@gmail.com wrote: 2 solutions : - check the id field is set and be sure it is rendered in form (hidden field : $form-renderHiddenFields()) - Add id to parameters : $this-form-bind(array_merge(array('id' = $id), $request-getParameter($this-form-getName(; Good luck 2009/8/31 krishan milepe...@gmail.com Friends I am facing a problem for updating a record in table in many steps. In each step I save the submitted data. This is my code $this-form = new ProfileForm(); $this-form-bind($request-getParameter($this-form-getName())); if ($this-form-isValid()) { $this-form-setOption('id', $request-getParameter('id')); $php_profile = $this-form-save(); } when I run $this-form-save(); function it adds a new record in database. But I want it to update the record provided with the id. Does anyone knows how to do that. I tried o use $this-form-setNew (false); but does not work with $this object... -- Alexandre Salomé -- alexandre.sal...@gmail.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: can't use Criteria() class in frontendConfiguration.class.php
I don't know what you want to do, but you can try in myUser.class.php something like class myUser extends sfBasicSecurityUser { public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array()) { parent::initialize($dispatcher, $storage, $options); // your code here } } It's not a very clean solution, but it should work... An alternative is to register a listener to an event symfony triggers somewhere, but you should check the symfony core. On Sep 2, 8:56 pm, javo javom...@gmail.com wrote: Hi there, I've read many Symfony docs and tried to explore Symfony code but I can't figure out where can I put some code that will be executed by every module/action (something like frontendConfiguration.class.php) Unfortunatelly I can't use Criteria() class there // I want to read some settings from my database using Peer object and use them on my website Is there any way how to do that? I'd really appreciate your help Thank you --~--~-~--~~~---~--~~ 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: can't use Criteria() class in frontendConfiguration.class.php
You should take a look at the symfony Routing Classes if your Criteria is based on the url (sfRoute / sfPropelRoute). There you can catch the url and do your database logic... Note, every defined route should then use that class ;) Or you should take a look at symfony Filters (sfFilter) http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer#chapter_06_sub_the_filter_chain Hope this suites, Gr Evert On Sep 2, 8:56 pm, javo javom...@gmail.com wrote: Hi there, I've read many Symfony docs and tried to explore Symfony code but I can't figure out where can I put some code that will be executed by every module/action (something like frontendConfiguration.class.php) Unfortunatelly I can't use Criteria() class there // I want to read some settings from my database using Peer object and use them on my website Is there any way how to do that? I'd really appreciate your help Thank you --~--~-~--~~~---~--~~ 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: can't use Criteria() class in frontendConfiguration.class.php
I would suggest reading the filter chapter again. On Sep 2, 8:56 pm, javo javom...@gmail.com wrote: Hi there, I've read many Symfony docs and tried to explore Symfony code but I can't figure out where can I put some code that will be executed by every module/action (something like frontendConfiguration.class.php) Unfortunatelly I can't use Criteria() class there // I want to read some settings from my database using Peer object and use them on my website Is there any way how to do that? I'd really appreciate your help Thank you --~--~-~--~~~---~--~~ 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] my first plugin
hello, I write my first plugin. This plugin will fetch data from google analytics api but I have one problem - plugin not work. I make default structure: plugins + sfGoogleAnalytics (name of my plugin) + + config + + modules + + + googleAnalytics + + + + actions + + + + lib + + + + config I enable plugin module in settings.yml in my application ( enabled_modules:[default, sfGuardAuth, comment, jsThumbnail, googleAnalytics] ) When I try to call the address http://my_host.com/googleAnalytics i have Action googleAnalytics/index does not exist. What's going on? --~--~-~--~~~---~--~~ 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: my first plugin
name it *sfGoogleAnalyticsPlugin* On Thu, Sep 3, 2009 at 12:25 PM, berni andr...@itma.pl wrote: hello, I write my first plugin. This plugin will fetch data from google analytics api but I have one problem - plugin not work. I make default structure: plugins + sfGoogleAnalytics (name of my plugin) + + config + + modules + + + googleAnalytics + + + + actions + + + + lib + + + + config I enable plugin module in settings.yml in my application ( enabled_modules:[default, sfGuardAuth, comment, jsThumbnail, googleAnalytics] ) When I try to call the address http://my_host.com/googleAnalytics i have Action googleAnalytics/index does not exist. What's going on? -- Thomas Rabaix http://rabaix.net --~--~-~--~~~---~--~~ 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 the module name bu giving a route name
Would be glad if anyone could 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: sfDoctrineActAsTaggablePlugin question
Yes, I get an error Couldn't find class tg On Wed, Sep 2, 2009 at 1:32 PM, Andrei Dziahel trickster...@gmail.comwrote: Hi. Have you tried to pass to getPopulars() a query similar to this one? $q = Doctrine_Query::create()-from('Article a')-where('a.active = ?', true); 2009/9/1 Kevin Bond kevinb...@gmail.com Hi Guys, I have a question about this plugin for anyone who knows about it. I have an Article model that I have set as Taggable. The article model has an 'active?' column. When selecting tags (ie using TagTable::getPopulars) I only want tags that are attached to active Articles to be returned. I see the getPopulars method has the option to add a doctrine query but I can't seem to figure out how to get it to work. The documentation shows that it can be done (I think) but it hasn't been translated from propel to doctrine yet. Anyone know how to do this? -- Kevin -- With the best regards, Andy. -- Kevin --~--~-~--~~~---~--~~ 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 the module name bu giving a route name
$routes = sfContext::getInstance()-getRouting()-getRoutes(); $route = $routes['Zip']; You can then have access to the sfRoute object On Thu, Sep 3, 2009 at 12:51 PM, Ahsanul ahsanu...@gmail.com wrote: Would be glad if anyone could help! -- Thomas Rabaix http://rabaix.net --~--~-~--~~~---~--~~ 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: my first plugin
Other than that, make sure to enable the plugin in the project configuration: $this-enablePlugins('nameOfThePlugin'); Bernhard -- Software Architect Engineer Blog: http://webmozarts.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups symfony users group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: how to get the module name bu giving a route name
Question: Why do you need to know the route??? is it important?? or you just want to know the module name?? Thomas Rabaix escribió: $routes = sfContext::getInstance()-getRouting()-getRoutes(); $route = $routes['Zip']; You can then have access to the sfRoute object On Thu, Sep 3, 2009 at 12:51 PM, Ahsanul ahsanu...@gmail.com mailto:ahsanu...@gmail.com wrote: Would be glad if anyone could help! -- Thomas Rabaix http://rabaix.net --~--~-~--~~~---~--~~ 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: sfForm-save() for an update
For this to work, you'll have to find existing records first and then use it while building the form object. -- $profile = "">Profile')-find($request-getParameter('id')); $this-form = new ProfileForm($profile); $this-form-bind($request-getParameter($this-form-getName())); if ($this-form-isValid()) { $php_profile = $this-form-save(); } -- Thanks Avnish Original Message Subject: [symfony-users] Re: sfForm-save() for an update From: Krishan .G milepe...@gmail.com To: symfony-users@googlegroups.com Date: Thursday 03 September 2009 02:31 PM Using both solutions getting following error.. Cannot insert a value for auto-increment primary key [Profile.ID] :( On Mon, Aug 31, 2009 at 6:00 PM, Alexandre SALOME alexandre.sal...@gmail.com wrote: 2 solutions : - check the id field is set and be sure it is rendered in form (hidden field : $form-renderHiddenFields()) - Add id to parameters : $this-form-bind(array_merge(array('id' = $id), $request-getParameter($this-form-getName(; Good luck 2009/8/31 krishan milepe...@gmail.com Friends I am facing a problem for updating a record in table in many steps. In each step I save the submitted data. This is my code $this-form = new ProfileForm(); $this-form-bind($request-getParameter($this-form-getName())); if ($this-form-isValid()) { $this-form-setOption('id', $request-getParameter('id')); $php_profile = $this-form-save(); } when I run $this-form-save(); function it adds a new record in database. But I want it to update the record provided with the id. Does anyone knows how to do that. I tried o use $this-form-setNew (false); but does not work with $this object... -- Alexandre Salom -- alexandre.sal...@gmail.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] propel:generate-admin module name
Hi Symfony developers :) I'm writing my first complex aplication in the Symfony framework and I have a problem with the propel admin generator. I'm using the Symfony 1.2.8 and trying to generate an admin module named auction_admin for the model class Auction: symfony propel:generate-admin frontend Auction --module=auction_admin But module has everytime the same name as the model (lowercased). Is it possible to generate admin module with a different name from the model class? Manual module renaming isn't work I would like to do :) Thanks very much. Have a nice developing :) -- Dawid Ferenczy http://www.ferenczy.cz --~--~-~--~~~---~--~~ 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] add field which does not belong to the model
I have this Code: class DenunciaForm extends BaseDenunciaForm { public function configure() { parent::configure(); $this-widgetSchema['remitido'] = new sfWidgetFormChoice(array( 'choices' = array('f' = 'Fiscalizacion', 'c' = 'Conciliacion') )); $this-widgetSchema['detalle'] = new sfWidgetFormTextArea(array(), array('cols' = '90', 'rows' = '10')); $this-setValidators(array( 'denunciado_id' = new sfValidatorString(array('required' = false)), 'denunciante_id' = new sfValidatorString(array('required' = false)), 'detalle' = new sfValidatorString( array('required' = true), array('required' = 'Campo Requerido') ), 'categoria_id'= new sfValidatorPropelChoice(array('model' = 'Categoria', 'column' = 'id')), 'ilicito_id' = new sfValidatorPropelChoice(array('model' = 'Ilicito', 'column' = 'id')), 'remitido'= new sfValidatorChoice(array( 'choices' = array('f' = 'Fiscalizacion', 'c' = 'Conciliacion') )), )); $this-widgetSchema-setLabels(array( 'categoria_id' = 'Categoria', 'ilicito_id' = 'Ilicito', 'remitido' = 'Remitir a' )); The problem is that no matter what i chose in the 'remitido' field, it always show the 'invalid' error message. How can i fix this?? Thank U --~--~-~--~~~---~--~~ 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: my first plugin
On Thu, 3 Sep 2009, berni wrote: When I try to call the address http://my_host.com/googleAnalytics i have Action googleAnalytics/index does not exist. You did not supply an action in your URL so index is called by default. Either put an action in the URL or change the default action in your routing. -- --~--~-~--~~~---~--~~ 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: User group and permission in sfGuardPlugin
has_credential: groupname is not the right way to check for a group. The right approach is to assign permissions *to the group*, and then check for those permissions with: actionName: is_secure: on credentials: [permission-name-here] You can assign permissions to a group via the sfGuardGroup module or the sfGuardPermission module. This way you can write secure code without worrying about which groups will later be given permission to do which things. While you're at it, make very sure you lock down the sfGuardUser, sfGuardGroup and sfGuardPermission modules themselves with: default: is_secure: on credentials: [admin] Do this at the app level: apps/frontend/modules/sfGuardUser/config/security.yml And the same for the other two modules. sfGuard does NOT do this by default. If you neglect this step your entire users and permissions setup is wide open for anyone to waltz in and make themselves a spiffy new superadmin account. -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.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] can't use Criteria() class in frontendConfiguration.class.php
Hi there, I've read many Symfony docs and tried to explore Symfony code but I can't figure out where can I put some code that will be executed by every module/action (something like frontendConfiguration.class.php) Unfortunatelly I can't use Criteria() class there // I want to read some settings from my database using Peer object and use them on my website Is there any way how to do that? I'd really appreciate your help Thank you --~--~-~--~~~---~--~~ 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] leftJoin() with Doctrine (DQL) between two databases
Hello, I'm using Doctrine as ORM and I configured my schema for that the tables are MyISAM, two databases, two connections, two schemas, etc. All right, it works correctly! but when I want to use leftJoin method to relation two (or more) tables, it says me: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db1.table2' doesn't exist #... Table1Table.class.php -getQuery() -from('Table1 t1') -leftJoin('t1.Table2 t2') #... # schema 1: Table1: columns: name: { type: string(150), notnull: false, unique: true } table2_id: { type: string(150), notnull: false } relations: Table2: { class: Table2, foreignType: one, onDelete: CASCADE } # schema 2: Table2: columns: name: { type: string(150), notnull: false, unique: true } The question is: How I do this query SQL with DQL? SELECT * FROM db1.`table1` t1 LEFT JOIN db2.`table2` t2 ON t1.table2_id=t2.id --~--~-~--~~~---~--~~ 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: my first plugin
Thomas, exactly - error was in the name of the directory ... Thanks all for help On Sep 3, 12:46 pm, Thomas Rabaix thomas.rab...@gmail.com wrote: name it *sfGoogleAnalyticsPlugin* On Thu, Sep 3, 2009 at 12:25 PM, berni andr...@itma.pl wrote: hello, I write my first plugin. This plugin will fetch data from google analytics api but I have one problem - plugin not work. I make default structure: plugins + sfGoogleAnalytics (name of my plugin) + + config + + modules + + + googleAnalytics + + + + actions + + + + lib + + + + config I enable plugin module in settings.yml in my application ( enabled_modules: [default, sfGuardAuth, comment, jsThumbnail, googleAnalytics] ) When I try to call the addresshttp://my_host.com/googleAnalyticsi have Action googleAnalytics/index does not exist. What's going on? -- Thomas Rabaixhttp://rabaix.net --~--~-~--~~~---~--~~ 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] Two foreign keys on a schema
Hi everyone. I'm working with a database not made by symfony. So, they are references made with more than one foreign key. Simplier: There is no a reference to one id, but a reference to 2 columns. There is CodItem1, and CodItem2 the foreign keys. Someone know how to define this on the schema?? I've tried this 2 ways without getting anything: relations: Maestroguiasdespachosm: onDelete: CASCADE local: CodItem1 foreign: CodItem1 local: CodItem2 foreign: CodItem2 foreignAlias: Detalleguiasdespachosms relations: Maestroguiasdespachosm: onDelete: CASCADE local: CodItem1, CodItem2 foreign: CodItem1, CodItem2 foreignAlias: Detalleguiasdespachosms 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: where do most Symfony developers resize images, in the Form class, or in a validator?
I will create a class that handle that, and passing some parameters I will do the resize/crop there. In this way you can reuse the code say from a batch script or the backend, etc. So you do this in a helper? Okay, but then where do you call the helper? The form class? The action? The validator? On Sep 3, 2:31 am, harryjekyll harryjek...@gmail.com wrote: I will create a class that handle that, and passing some parameters I will do the resize/crop there. In this way you can reuse the code say from a batch script or the backend, etc. On Sep 3, 2009, at 1:35 PM, Jake Barnes wrote: I've a form that allows users to upload images that can represent them on the site. I need to crop and resize the images to be sure they are all the same size. I am curious where do most Symfony developers put their code for resizing images? In the form class? I assume it is bad practice to do this in the action? --~--~-~--~~~---~--~~ 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: my first plugin
name it *sfGoogleAnalyticsPlugin* I thought the initials sf were suppose to indicate that the plugin came from the core Symfony team? I remember asking about this once last year, and someone suggested to me that I use my own initials for the first 2 letters. lawrence On Sep 3, 6:46 am, Thomas Rabaix thomas.rab...@gmail.com wrote: name it *sfGoogleAnalyticsPlugin* On Thu, Sep 3, 2009 at 12:25 PM, berni andr...@itma.pl wrote: hello, I write my first plugin. This plugin will fetch data from google analytics api but I have one problem - plugin not work. I make default structure: plugins + sfGoogleAnalytics (name of my plugin) + + config + + modules + + + googleAnalytics + + + + actions + + + + lib + + + + config I enable plugin module in settings.yml in my application ( enabled_modules: [default, sfGuardAuth, comment, jsThumbnail, googleAnalytics] ) When I try to call the addresshttp://my_host.com/googleAnalyticsi have Action googleAnalytics/index does not exist. What's going on? -- Thomas Rabaixhttp://rabaix.net --~--~-~--~~~---~--~~ 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: help with customizing sfguard
In answer to your second question. Towards the end of the sfGuard doc there is a section regarding this. Cut and paste from there: (http://www.symfony-project.org/plugins/ sfGuardPlugin) You can change the redirect values in app.yml: all: sf_guard_plugin: success_signin_url: @my_route?param=value # the plugin use the referer as default success_signout_url: module/action # the plugin use the referer as default There is also documentation about LDAP, although I have never used it so not sure if it will be helpful. On Sep 3, 2:09 pm, jarthel jart...@gmail.com wrote: more questions please :) 1. how do I display validation errors in custom template? I was able to find the source of the default signinSuccess.php but it's unclear on what to include in my template. I believe the default form uses this class = sfGuardFormSignin.class.php. 2. How do I tell sfGuard to redirect to a particular page once login is successful? 3. Do I need to have records in sf_user if I'm authenticating via LDAP? Thanks again :) --~--~-~--~~~---~--~~ 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: help with customizing sfguard
new questions please :) I want to change the validation. username uses sfValidatorString. I want to use sfCallbackValidator. Do I need to edit the original class or do I need to create my own? thank you --~--~-~--~~~---~--~~ 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] Check duplicate for registration
Hi Everyone, I m very new to symfony. I have created Registration form in my project. But how can I *check for duplicate username*? Can I use any *SFVALIDATOR* for this? OR if I am checking from my action page, after submitting the details, then I want to redirect again to my registration page. *How I make* *all the data filled in the textboxes?*. Is there any easy way to do this? Pls help me. 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: Check duplicate for registration
On Fri, 4 Sep 2009, avani pujara wrote: I m very new to symfony. I have created Registration form in my project. But how can I *check for duplicate username*? Can I use any *SFVALIDATOR* for this? http://www.symfony-project.org/book/1_2/10-Forms#chapter_10_form_validation OR if I am checking from my action page, after submitting the details, then I want to redirect again to my registration page. *How I make* *all the data filled in the textboxes?*. Is there any easy way to do this? Pls help me. http://www.symfony-project.org/book/1_2/10-Forms#chapter_10_sub_redisplaying_the_form -- --~--~-~--~~~---~--~~ 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: add field which does not belong to the model
On Thu, 3 Sep 2009, Germana Oliveira wrote: I have this Code: class DenunciaForm extends BaseDenunciaForm { public function configure() { parent::configure(); $this-widgetSchema['remitido'] = new sfWidgetFormChoice(array( 'choices' = array('f' = 'Fiscalizacion', 'c' = 'Conciliacion') )); $this-widgetSchema['detalle'] = new sfWidgetFormTextArea(array(), array('cols' = '90', 'rows' = '10')); $this-setValidators(array( 'denunciado_id' = new sfValidatorString(array('required' = false)), 'denunciante_id' = new sfValidatorString(array('required' = false)), 'detalle' = new sfValidatorString( array('required' = true), array('required' = 'Campo Requerido') ), 'categoria_id'= new sfValidatorPropelChoice(array('model' = 'Categoria', 'column' = 'id')), 'ilicito_id' = new sfValidatorPropelChoice(array('model' = 'Ilicito', 'column' = 'id')), 'remitido'= new sfValidatorChoice(array( 'choices' = array('f' = 'Fiscalizacion', 'c' = 'Conciliacion') )), )); $this-widgetSchema-setLabels(array( 'categoria_id' = 'Categoria', 'ilicito_id' = 'Ilicito', 'remitido' = 'Remitir a' )); The problem is that no matter what i chose in the 'remitido' field, it always show the 'invalid' error message. How can i fix this?? Is it a required field? If its optional then you can do something like: $this-validatorSchema['remitido']-setOption('required', false); inside your configure() method. -- --~--~-~--~~~---~--~~ 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: sfForm-save() for an update
Thank you Avnish, I got that, But is there some other way in which we do not need to retrieve record first and then update. I know one which is by using $form = new Profile() and then using $form-setNew(false) for update, instead of using new ProfileForm object. But I was not able to verify the value using $form-isValid(). Is it possible to make form validation this way that ProfileForm (sForm) object does? On Thu, Sep 3, 2009 at 6:32 PM, Avnish Pundir avnish.pun...@tekmindz.comwrote: For this to work, you'll have to find existing records first and then use it while building the form object. -- $profile = Doctrine::getTable('*Profile* ')-find($request-getParameter('id')); $this-form = new ProfileForm($profile); $this-form-bind($request-getParameter($this-form-getName())); if ($this-form-isValid()) { $php_profile = $this-form-save(); } -- Thanks Avnish Original Message Subject: [symfony-users] Re: sfForm-save() for an update From: Krishan .G milepe...@gmail.com milepe...@gmail.com To: symfony-users@googlegroups.com Date: Thursday 03 September 2009 02:31 PM Using both solutions getting following error.. Cannot insert a value for auto-increment primary key [Profile.ID] :( On Mon, Aug 31, 2009 at 6:00 PM, Alexandre SALOME alexandre.sal...@gmail.com wrote: 2 solutions : - check the id field is set and be sure it is rendered in form (hidden field : $form-renderHiddenFields()) - Add id to parameters : $this-form-bind(array_merge(array('id' = $id), $request-getParameter($this-form-getName(; Good luck 2009/8/31 krishan milepe...@gmail.com Friends I am facing a problem for updating a record in table in many steps. In each step I save the submitted data. This is my code $this-form = new ProfileForm(); $this-form-bind($request-getParameter($this-form-getName())); if ($this-form-isValid()) { $this-form-setOption('id', $request-getParameter('id')); $php_profile = $this-form-save(); } when I run $this-form-save(); function it adds a new record in database. But I want it to update the record provided with the id. Does anyone knows how to do that. I tried o use $this-form-setNew (false); but does not work with $this object... -- Alexandre Salomé -- alexandre.sal...@gmail.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: help with customizing sfguard
I need to use a custom validators because the username can be either username or an email address. If the user supplied an email address, I need to check if the email address supplied is valid. I have created 4 files which I have mentioned below. my custom validator (usernameChecker) throws an error or return a true if validation is okay. I have typed in a valid email address. My usernameChecker returns a true. BUT sfGuard still displays an error. Can you please help? ++ actions.class.php: http://www.pastebin.ca/1553480 (basically it's the same as the original signin function form sfGuard except that it's displaying my custom form. see file no. 2) sfGuardAuth.class.php: http://www.pastebin.ca/1553481 usernameChecker.class.php: http://www.pastebin.ca/1553482 validateEmail.class.php: http://www.pastebin.ca/1553484 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---