[symfony-users] sfWidgetFormSelect multiple defaults
I have an sfWidgetFormSelect set to 'multiple' like this in my form: $sel = DbFinder::from('category')->find(); $this->widgetSchema['category'] = new sfWidgetFormSelect(array('choices'=>$sel, 'multiple'=>'true')); I need to set multiple defaults - how can I do that? I can set one like this: $this->setDefaults(array('category' =>2)); but how do I set multiples as defaults? Actually, I'm trying to read the categories from the database and set those that have been selected previously. Can anyone help? Thanks! Cindy --~--~-~--~~~---~--~~ 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: Triggering sfValidatorAnd when form field is blank
Just a reply for others... After some sleep I realised the best way to do this was with a single setPostValidator which called a single sfValidatorCallback to validate all 5 fields... Inside the callback class, I tested for the existence of each field (by checking the array of form values submitted with array_key_exists), then validated it if it was there... It just has a single error message at the top of the page which says something along the lines of "one of these fields are required for each set of data"... not perfect, I'd like to have the error where the fields are, but it does the job ok. On Oct 28, 6:20 pm, John Masson <[EMAIL PROTECTED]> wrote: > Hi All, > > I've spent the day working on the problem of validating two fields to > ensure one of the two has been filled in. I don't mind if the user > fills in both, I just one at least one completed, not both blank. > > I got this working nicely with a sfValidatorCallback inside of a > setPostValidator, however when I went to repeat this for multiple > fields on the same page (there can be up to 5 sets of the same fields > depending on what the user has selected previously) I realised that > essentially only the last of the set got validated... > > So I turned to trying to get this working with an sfValidatorCallback > on one of the two fields. The problem here though is that when the > user leaves the field blank, no error checking is done at all... I > also tried with the sfValidatorCallback inside a sfValidatorAnd, but > this too failed > > Is there any way to 'force' the error checking of a field even though > it's blank?? Do I need to perhaps use a setPostValidator to trigger > off these individual callbacks? > > I've pasted some code below, in this case where I was trying with the > sfValidatorAnd. > > Any assistance greatly appreciated... > > The validator: > $this->validatorSchema['Account # 5'] = new sfValidatorAnd( > array( > new sfValidatorString(array('min_length' => 2, > 'required' => false)), > new sfValidatorCallback(array('callback' => > array('customValidator_5', 'execute'), 'arguments' => array()), > array('invalid' => 'Error Message #5')), > ) > ); > > The validation Class: > class CustomValidator_5 > { > public static function execute($oValidator) { > //get the values entered for the customer account num and dob > fields > $req = sfContext::getInstance()->getRequest()->getParameter('orderThree'); > > $current_account = $req['Account # 5']; > $customer_dob = $req['Customer DOB 5']; > //If both are blank, throw error > if($current_account == '' && $customer_dob['day'] =='' && > $customer_dob['month'] =='' && $customer_dob['year'] =='') { > throw new sfValidatorError($oValidator, 'invalid'); > } > } > > } --~--~-~--~~~---~--~~ 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: Sending partial form data
I've now used the following in BaseFormPropel.class.php, which takes into account if a form field was unset() during your configure() public function bind(array $taintedValues = null, array $taintedFiles = null) { $defs = $this->getDefaults(); $defaults = array(); foreach ($defs as $field=>$value) { if (in_array($field, array_keys($this->widgetSchema- >getFields( { $defaults[$field] = $value; } } $taintedValues = array_merge($defaults, $taintedValues); parent::bind($taintedValues, $taintedFiles); } Still working to see if this will actually do what I want to do, but this seems to allow me to submit only a single value (or certain values) required in my form, while having all other fields "inherit" the values they currently have, based on the object the form is instantiated with. HTH Beau --~--~-~--~~~---~--~~ 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: Sending partial form data
Paul, This sounded like a good approach, so I tried it out in a scenario where I'm having some similar problems to what you described. The issue that I noticed though, was that in combining the defaults with the tainted values, I get back values for fields which I've specifically unset() in my Form configuration (created_at, modified_at, etc). So basically, to use this method, I'd need to be able to take into account which fields have been unset somehow. I'll see if I can figure anything out, because it seems to at least be a step in the right direction for submitting on certain parts of a Form, without setting other values to NULL. That is of course, unless someone else can point out a better way to do this? Cheers, Beau On Oct 3, 1:34 pm, "Paul Jones" <[EMAIL PROTECTED]> wrote: > So I have worked around the problem I discovered. In the BaseFormPropel > class I overrode the bind method so that, in essence, $taintedValues start > with the default values instead of starting with all null values. This way > if I do not pass in a value, the current value is not changed. I can still > set a value to null if I pass in the key with a null value, but I can also > now leave a value unchanged. > public function bind(array $taintedValues = null, array $taintedFiles = > null) > { > $taintedValues = array_merge($this->getDefaults(), $taintedValues); > parent::bind($taintedValues, $taintedFiles); > > } > > I think it would be nice to have this type of functionality available as a > option in forms generally, especially in a REST context. Anyone else think > this would be nice, or see any blatant problems with this? > > Thanks, > paul > > On Fri, Oct 3, 2008 at 10:13 AM, Paul Jones <[EMAIL PROTECTED]> wrote: > > Hello, > > > I have a question about how forms are supposed to behave. I generated > > a basic crud interface and interact with it via ajax. When I call the > > update method a sfFormPropel form is created, the post data is bound > > to the form and then the form is saved if it is valid. All the basic > > stuff. The only interesting thing is that if I only submit the id and > > name of the object, then all the other fields are saved as null. I > > expected fields that I did not submit to be left untouched. Did I have > > the wrong expectations or did I uncover a bug? > > > I am using symfony 1.2 HEAD. > > > Thanks in advance, > > paul --~--~-~--~~~---~--~~ 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] extjs plugin working with symfony 1.1 or 1.2 ??
is there any version of extjs plugin working with symfony 1.1 or 1.2 ?? SVN or customized by anybody? what do you think about this approach to javascript frameworks presented in sfExtjs2Plugin is it more programmer/designer friendly? more MVC oriented or not ?? --~--~-~--~~~---~--~~ 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: Many to Many, Symfony 1.1, sForms
Ok, thanks ! My schema.yml was not correct ! Example of a correct schema : propel: language: id: ~ label: { type: varchar(255), requierd: true} member: id: ~ name: { type: varchar(255), required: true} member_has_language: member_id: { type: integer, required: true, primaryKey: true, foreignTable: member, foreignReference: id} language_id: { type: integer, required: true, primaryKey: true, foreignTable: language, foreignReference: id} Thanks a lot ;-) On Oct 22, 1:17 pm, Drahpal <[EMAIL PROTECTED]> wrote: > Hi > > > Je suis confronté à un problème. J'ai pris connaissance de l'existence > > de sfWidgetFormPropelMany, donc le rôle est normalement de traiter les > > cas de relations M2M. Le problème est que j'ai des relations n<=>n > > dans mon projet, mais que la fonction sfWidgetFormPropelMany > > n'apparaît jamais dans mes BaseMaClasseForm. > > Maybe it is not clear in the schema.yml file. You have to check that > the m2m table have the primary key of each other, and those columns > are the primary key of the m2m table. Also that the foreign keys are > correct. > > Drahpal --~--~-~--~~~---~--~~ 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: Problems with sfDoctrinePlugin
It looks like you checked out trunk which is for symfony 1.2 and you need to check out the 1.1 branch. - Jon On Mon, Oct 27, 2008 at 10:21 AM, ShoGuN <[EMAIL PROTECTED]> wrote: > > You has download a wrong branche. > > Regards! > > On 27 oct, 06:34, "Reynier Perez Mira" <[EMAIL PROTECTED]> wrote: > > Hi every: > > I'm trying to migrate my projects from Propel to Doctrine. Today I did a > checkout from sfDoctrinePlugin SVN and copy the code to plugins dir. When I > try to clear the cache I get this error: > > > > D:\Development\WWW\gestion.local>symfony cache:clear --app=backend > --env=dev>> cache Clearing cache type "all" for "backend" app and "dev" > env > > > > PHP Fatal error: Class 'sfWebDebugPanel' not found in > D:\Development\WWW\gestio > > > n.local\plugins\sfDoctrinePlugin\lib\debug\sfWebDebugPanelDoctrine.class.php > on > > line 21 > > > > Fatal error: Class 'sfWebDebugPanel' not found in > D:\Development\WWW\gestion.loc > > al\plugins\sfDoctrinePlugin\lib\debug\sfWebDebugPanelDoctrine.class.php > on line > > 21 > > > > Can any help me with this? > > > > Cheers and thanks in advance > > Ing. Reynier Pérez Mira > > Dirección Técnica IP > > > -- Jonathan H. Wage Open Source Software Developer & Evangelist http://www.jwage.com http://www.doctrine-project.org http://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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony and code performance overhead
On Oct 28, 5:02 am, Peter Bowyer <[EMAIL PROTECTED]> wrote: > how much code performance overhead does Symfony add to your web > apps? I monkeyed with Zend for a bit and discovered that even its > basic MVC framework significantly increased response times. Similarly, > to those of you who have used any of the other PHP frameworks, how do > they perform? As someone else mentioned, ALL frameworks add overhead. And there's always a counter argument for their use too. Like most things, its a trade-off between ease and cost of development versus server overhead and response time. However, symfony has many ways of tweaking performance via caching, tweaking queries, switching off unneeded features etc. I think the fact that some quite large sites* run on symfony says more than anyone can say. * http://www.symfony-project.org/blog/category/Case+studies -- --~--~-~--~~~---~--~~ 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] Multiple tinymce fields in admin generator
I've set multiple tinymce fields in a admin generator config.yml but there is somes issues. The problem is : only the first field is embeded, but only the second field record the entries. Have seen that there is a tinymce field with "display:none" parameter just before the embeded one, and if I write in it, the modifications are registered. If anyone has already met this problem and fixed it I am interested :) thanks Ludovic --~--~-~--~~~---~--~~ 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: sfValidatorPropelUnique giving problems when updating sfGuardUserProfile
Hello, I had the same problem and found out a solution : First, have a look at http://www.symfony-project.org/forum/index.php/m/60712/ where you have an explanation of a potential problem in view $form[id] should be between tables. Second, i did the following test to prevent from errors on updating : if ($this->getObject()->isNew()) { $this->validatorSchema->setPostValidator( new sfValidatorAnd(array( new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 'column' => array('username')), array('invalid'=>'Un utilisateur avec le login est déjà enregistré')), new sfValidatorPropelUnique(array('model' => 'SfGuardUserProfile', 'column' => array('email')), array('invalid'=>'Un utilisateur avec cet email est déjà enregistré')) ))); } Hope it helps Sébastien epfactory.com On 26 oct, 18:21, Flancer <[EMAIL PROTECTED]> wrote: > Based on a the symfony propel:generate-crud command for the > sfguarduser model, which automagically generates forms that updates > both the username and password together with the user profile. > > I have enabled two unique fields, e-mail and fullname for the user > profile model. > > Whenever I update a record without changing any of the unique field > values, I would get an error that says an object with the same e-mail > and fullname already exists. > > How can I solve this without getting rid of the > sfValidatorPropelUnique class? > > Has anyone else come across the same issue when working with > sfguarduserprofile? > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~--~~~~--~~--~--~---
[symfony-users] Re: Symfony and code performance overhead
Hi I dont think that 10ms might be an issue in development if u r doing well with market time and scalability. I am not sure about ur application functionality and it's target but as for Web2.0 application Symfony can be good choise. For the first try Symfony might seem a bit slow especially ORM layer but despite this, Symfony is fine with 2 minor needs: Market time and scalability(example: yahoo answers). In my new application i planning to use Symfony as frontend platform. All hard works done by backend service nodes and i dont worry about few millisecond eficiencies since i can handle the further scalabilty with it. Shuxer. On Tue, Oct 28, 2008 at 5:02 PM, Peter Bowyer <[EMAIL PROTECTED]>wrote: > > Hi list, > > I got asked this question today, after recommending Symfony as a web > framework of choice: > --- > how much code performance overhead does Symfony add to your web > apps? I monkeyed with Zend for a bit and discovered that even its > basic MVC framework significantly increased response times. Similarly, > to those of you who have used any of the other PHP frameworks, how do > they perform? > --- > > I know there must be some overhead but it's not a question I've looked > into, as (for me) ease and reliability of development are much more > important than 10s of milliseconds. What would your responses be? Have > you any figures/scenarios to show it's not an issue? > > Thanks, > Peter > > > -- Best Regards, Thank You, Shuhrat Saipov, ICQ: 330-159-765 Yahoo Messenger ID: shuhrat.saipov --~--~-~--~~~---~--~~ 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 and code performance overhead
Hi Peter, This is always an interesting discussion. Using a framework will always add overhead. Symfony definitely adds some overhead. There are quite a few optimization steps (like turning off databases if you dont use them) that can be done to lower the overhead, but there is always overhead. I always wonder why people would focus on the overhead in the first place. I'd really like to know the reason behind this question. A framework brings efficiency and structure to your development, and using good caching strategies and things like the debug toolbar for optimizing the application will help it run smoothly. In the case the application becomes very big/popular, adding a new server is much cheaper than the extra developer you need if you don't use a framework. I know Rasmus did an "anti-framework" presentation at OSCON that contained some benchmark data, and even though it's not representative it will give an indication of overhead (as that was the point Rasmus was making in the first place). Perhaps that information may help you. Really, you should not be using that information as it's not representative though. Stefan On Tue, Oct 28, 2008 at 10:02 AM, Peter Bowyer <[EMAIL PROTECTED]> wrote: > > Hi list, > > I got asked this question today, after recommending Symfony as a web > framework of choice: > --- > how much code performance overhead does Symfony add to your web > apps? I monkeyed with Zend for a bit and discovered that even its > basic MVC framework significantly increased response times. Similarly, > to those of you who have used any of the other PHP frameworks, how do > they perform? > --- > > I know there must be some overhead but it's not a question I've looked > into, as (for me) ease and reliability of development are much more > important than 10s of milliseconds. What would your responses be? Have > you any figures/scenarios to show it's not an issue? > > Thanks, > Peter > > > --~--~-~--~~~---~--~~ 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 and code performance overhead
Hi list, I got asked this question today, after recommending Symfony as a web framework of choice: --- how much code performance overhead does Symfony add to your web apps? I monkeyed with Zend for a bit and discovered that even its basic MVC framework significantly increased response times. Similarly, to those of you who have used any of the other PHP frameworks, how do they perform? --- I know there must be some overhead but it's not a question I've looked into, as (for me) ease and reliability of development are much more important than 10s of milliseconds. What would your responses be? Have you any figures/scenarios to show it's not an issue? Thanks, Peter --~--~-~--~~~---~--~~ 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] Triggering sfValidatorAnd when form field is blank
Hi All, I've spent the day working on the problem of validating two fields to ensure one of the two has been filled in. I don't mind if the user fills in both, I just one at least one completed, not both blank. I got this working nicely with a sfValidatorCallback inside of a setPostValidator, however when I went to repeat this for multiple fields on the same page (there can be up to 5 sets of the same fields depending on what the user has selected previously) I realised that essentially only the last of the set got validated... So I turned to trying to get this working with an sfValidatorCallback on one of the two fields. The problem here though is that when the user leaves the field blank, no error checking is done at all... I also tried with the sfValidatorCallback inside a sfValidatorAnd, but this too failed Is there any way to 'force' the error checking of a field even though it's blank?? Do I need to perhaps use a setPostValidator to trigger off these individual callbacks? I've pasted some code below, in this case where I was trying with the sfValidatorAnd. Any assistance greatly appreciated... The validator: $this->validatorSchema['Account # 5'] = new sfValidatorAnd( array( new sfValidatorString(array('min_length' => 2, 'required' => false)), new sfValidatorCallback(array('callback' => array('customValidator_5', 'execute'), 'arguments' => array()), array('invalid' => 'Error Message #5')), ) ); The validation Class: class CustomValidator_5 { public static function execute($oValidator) { //get the values entered for the customer account num and dob fields $req = sfContext::getInstance()->getRequest()- >getParameter('orderThree'); $current_account = $req['Account # 5']; $customer_dob = $req['Customer DOB 5']; //If both are blank, throw error if($current_account == '' && $customer_dob['day'] =='' && $customer_dob['month'] =='' && $customer_dob['year'] =='') { throw new sfValidatorError($oValidator, 'invalid'); } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---