[symfony-users] Re: too many queries with embedded forms
Oups, it was not CanardCategorieForm, this is it : unset( $this['created_at'], $this['updated_at'], $this['canard_groupe_list'] ); $this->setWidget('description', new sfWidgetFormTextarea(array(), array('size' => '20x5'))); $this->setWidget('vol_id', new sfWidgetFormDoctrineChoice(array('model' => $this- >getRelatedModelName('CanardVol'), 'add_empty' => true))); $this->setWidget('cancan_id', new sfWidgetFormDoctrineChoice(array('model' => $this- >getRelatedModelName('CanardCancan'), 'add_empty' => true))); $this->setWidget('photo', new sfWidgetFormInputFileEditable(array( 'label' => 'Photo', 'file_src'=> $this->getObject()->getCanardFileSrcMini(), 'edit_mode' => !$this->isNew(), 'is_image'=> !is_null($this->getObject()->getCanardFileSrc()), 'delete_label' => 'Supprimer', 'template' => '%file%%input%%delete% %delete_label%', ))); $this->validatorSchema['photo_delete'] = new sfValidatorPass(); $this->setValidator('photo', new sfValidatorFile(array( 'mime_types' => 'web_images', 'path' => $this->getObject()->getCanardDirPath(), 'required' => false ))); On 19 août, 09:28, spike3111 wrote: > >Daniel, > > Thank for you help, I send you the email. > And here my form: > > $this->setWidget('intitule', new sfWidgetFormTextarea(array(), > array('cols' => '40'))); > > $this->setWidget('activites_list', new > sfWidgetFormSelectDoubleList(array( > 'choices' => > Doctrine_Core::getTable('CanardActivites')->createQuery('a')->execute(), > > 'label_associated' => 'Associé', > 'label_unassociated' => 'Dissocié' > ))); > > $this->embedRelations(array( > 'CanardMaresA' => array( > 'considerNewFormEmptyFields' => array('intitule', 'vol_id', > 'cancan_id', 'photo'), > 'multipleNewForms' => true, > 'newFormsInitialCount' => 1, > 'newRelationButtonLabel' => '+', > 'displayEmptyRelations' => true, > 'formClassArgs' => > array(array('ah_add_delete_checkbox' => true)), > 'newFormClass' => 'CanardMareEmbedForm', > 'formClass' => 'CanardMareEmbedForm' > ) > )); > > (CanardMareEmbedForm is just to change order of fields) > > On 19 août, 02:01, Richtermeister wrote: > > > I've come across this as well, and the reason is that many of the > > choice widgets fire off a query to populate themselves. if you have 4 > > relationships per object that gives you 4 queries, and by embedding > > that many times, it multiplies quickly. > > I don't think there's anything you can do about this other than > > implement some kind of widget-level caching. > > > Daniel > > > On Aug 18, 4:07 pm, Daniel Lohse wrote: > > > > Mhm, that sure sounds like a lot. :( In the example I've given in the > > > README I only have one additional query per embedded relation so > > > something must be going wrong. > > > > Can you post the content's of your CanardCategorie form's configure() > > > method please? And a couple of screenshots showing the admin interface > > > (so I can see the embedded forms and what they contain) and the "SQL > > > queries" web debug bar opened would be great! (you can also zip them up > > > and send them to my Google email address (annismcken...@gmail.com) > > > directly so we don't burden the group with this) > > > > Cheers, Daniel > > > > On 18.08.2010, at 16:39, spike3111 wrote: > > > > > Hello, > > > > > I use the plugi ahDoctrineEasyEmbeddedRelationsPlugin to embed forms. > > > > My schema is basic, I have a pet that may have a type of crying, a > > > > type of displacement, a place to live and belong to a group. So a four > > > > relationships one to many. > > > > > I wanted my embed forms of animals in the middle of life. So I get the > > > > opportunity to modify or remove an animal. But for 13 animals nested, > > > > I get 60 requests! > > > > Hey, it's a bit much ... How can we reduce this number? I searched > > > > everywhere, but I can not find answers. > > > > > CanardCategorie: > > > > columns: > > > > vol_id: { type: integer, notnull: true } > > > > cancan_id: { type: integer, notnull: true } > > > > mare_id: { type: integer, notnull: true } > > > > groupe_id: { type: integer, notnull: false } > > > > intitule: { type: string(255), notnull: true, unique: true } > > > > description: { type: string(255), notnull: false } > > > > photo: { type: string(255), notnull false } > > > > relations: > > > > CanardVol: { onDelete: CASCADE, local: vol_id, foreign: id, > > > > foreignAlias: CanardVols } > > > > CanardCancan: { onDelete: CASCADE, local: cancan_id, foreign: id, > > > > foreignAlias: CancardCancans } > > > > CanardMare: {
[symfony-users] Re: too many queries with embedded forms
>Daniel, Thank for you help, I send you the email. And here my form: $this->setWidget('intitule', new sfWidgetFormTextarea(array(), array('cols' => '40'))); $this->setWidget('activites_list', new sfWidgetFormSelectDoubleList(array( 'choices' => Doctrine_Core::getTable('CanardActivites')- >createQuery('a')->execute(), 'label_associated' => 'Associé', 'label_unassociated' => 'Dissocié' ))); $this->embedRelations(array( 'CanardMaresA' => array( 'considerNewFormEmptyFields' => array('intitule', 'vol_id', 'cancan_id', 'photo'), 'multipleNewForms' => true, 'newFormsInitialCount' => 1, 'newRelationButtonLabel'=> '+', 'displayEmptyRelations' => true, 'formClassArgs' => array(array('ah_add_delete_checkbox' => true)), 'newFormClass' => 'CanardMareEmbedForm', 'formClass' => 'CanardMareEmbedForm' ) )); (CanardMareEmbedForm is just to change order of fields) On 19 août, 02:01, Richtermeister wrote: > I've come across this as well, and the reason is that many of the > choice widgets fire off a query to populate themselves. if you have 4 > relationships per object that gives you 4 queries, and by embedding > that many times, it multiplies quickly. > I don't think there's anything you can do about this other than > implement some kind of widget-level caching. > > Daniel > > On Aug 18, 4:07 pm, Daniel Lohse wrote: > > > Mhm, that sure sounds like a lot. :( In the example I've given in the > > README I only have one additional query per embedded relation so something > > must be going wrong. > > > Can you post the content's of your CanardCategorie form's configure() > > method please? And a couple of screenshots showing the admin interface (so > > I can see the embedded forms and what they contain) and the "SQL queries" > > web debug bar opened would be great! (you can also zip them up and send > > them to my Google email address (annismcken...@gmail.com) directly so we > > don't burden the group with this) > > > Cheers, Daniel > > > On 18.08.2010, at 16:39, spike3111 wrote: > > > > Hello, > > > > I use the plugi ahDoctrineEasyEmbeddedRelationsPlugin to embed forms. > > > My schema is basic, I have a pet that may have a type of crying, a > > > type of displacement, a place to live and belong to a group. So a four > > > relationships one to many. > > > > I wanted my embed forms of animals in the middle of life. So I get the > > > opportunity to modify or remove an animal. But for 13 animals nested, > > > I get 60 requests! > > > Hey, it's a bit much ... How can we reduce this number? I searched > > > everywhere, but I can not find answers. > > > > CanardCategorie: > > > columns: > > > vol_id: { type: integer, notnull: true } > > > cancan_id: { type: integer, notnull: true } > > > mare_id: { type: integer, notnull: true } > > > groupe_id: { type: integer, notnull: false } > > > intitule: { type: string(255), notnull: true, unique: true } > > > description: { type: string(255), notnull: false } > > > photo: { type: string(255), notnull false } > > > relations: > > > CanardVol: { onDelete: CASCADE, local: vol_id, foreign: id, > > > foreignAlias: CanardVols } > > > CanardCancan: { onDelete: CASCADE, local: cancan_id, foreign: id, > > > foreignAlias: CancardCancans } > > > CanardMare: { local: mare_id, foreign: id, foreignAlias: > > > CanardMaresA, alias: CanardMare, foreignType: many } > > > CanardGroupe: { local: groupe_id, foreign: id, foreignAlias: > > > CanardGroupe } > > > > CanardVol: > > > columns: > > > intitule: { type: string(255), notnull: true, unique: true } > > > > CanardCancan: > > > columns: > > > intitule: { type: string(255), notnull: true, unique: true } > > > > CanardMare: > > > columns: > > > intitule: { type: string(255), notnull: true } > > > temperature: { type: integer, notnull: true } > > > > CanardGroupe: > > > columns: > > > intitule: { type: string(255), notnull: true } > > > > Thank you ! > > > > (I'm French, , Can be had noticed it !) > > > > -- > > > If you want to report a vulnerability issue on symfony, please send it to > > > security at symfony-project.com > > > > You received this message because you are subscribed to the Google > > > Groups "symfony users" group. > > > To post to this group, send email to symfony-users@googlegroups.com > > > To unsubscribe from this group, send email to > > > symfony-users+unsubscr...@googlegroups.com > > > For more options, visit this group at > > >http://groups.google.com/group/symfony-users?hl=en > > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroup
[symfony-users] Re: too many queries with embedded forms
I've come across this as well, and the reason is that many of the choice widgets fire off a query to populate themselves. if you have 4 relationships per object that gives you 4 queries, and by embedding that many times, it multiplies quickly. I don't think there's anything you can do about this other than implement some kind of widget-level caching. Daniel On Aug 18, 4:07 pm, Daniel Lohse wrote: > Mhm, that sure sounds like a lot. :( In the example I've given in the README > I only have one additional query per embedded relation so something must be > going wrong. > > Can you post the content's of your CanardCategorie form's configure() method > please? And a couple of screenshots showing the admin interface (so I can see > the embedded forms and what they contain) and the "SQL queries" web debug bar > opened would be great! (you can also zip them up and send them to my Google > email address (annismcken...@gmail.com) directly so we don't burden the group > with this) > > Cheers, Daniel > > On 18.08.2010, at 16:39, spike3111 wrote: > > > Hello, > > > I use the plugi ahDoctrineEasyEmbeddedRelationsPlugin to embed forms. > > My schema is basic, I have a pet that may have a type of crying, a > > type of displacement, a place to live and belong to a group. So a four > > relationships one to many. > > > I wanted my embed forms of animals in the middle of life. So I get the > > opportunity to modify or remove an animal. But for 13 animals nested, > > I get 60 requests! > > Hey, it's a bit much ... How can we reduce this number? I searched > > everywhere, but I can not find answers. > > > CanardCategorie: > > columns: > > vol_id: { type: integer, notnull: true } > > cancan_id: { type: integer, notnull: true } > > mare_id: { type: integer, notnull: true } > > groupe_id: { type: integer, notnull: false } > > intitule: { type: string(255), notnull: true, unique: true } > > description: { type: string(255), notnull: false } > > photo: { type: string(255), notnull false } > > relations: > > CanardVol: { onDelete: CASCADE, local: vol_id, foreign: id, > > foreignAlias: CanardVols } > > CanardCancan: { onDelete: CASCADE, local: cancan_id, foreign: id, > > foreignAlias: CancardCancans } > > CanardMare: { local: mare_id, foreign: id, foreignAlias: > > CanardMaresA, alias: CanardMare, foreignType: many } > > CanardGroupe: { local: groupe_id, foreign: id, foreignAlias: > > CanardGroupe } > > > CanardVol: > > columns: > > intitule: { type: string(255), notnull: true, unique: true } > > > CanardCancan: > > columns: > > intitule: { type: string(255), notnull: true, unique: true } > > > CanardMare: > > columns: > > intitule: { type: string(255), notnull: true } > > temperature: { type: integer, notnull: true } > > > CanardGroupe: > > columns: > > intitule: { type: string(255), notnull: true } > > > Thank you ! > > > (I'm French, , Can be had noticed it !) > > > -- > > If you want to report a vulnerability issue on symfony, please send it to > > security at symfony-project.com > > > You received this message because you are subscribed to the Google > > Groups "symfony users" group. > > To post to this group, send email to symfony-users@googlegroups.com > > To unsubscribe from this group, send email to > > symfony-users+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en