Re: [symfony-users] ahDoctrineEasyEmbeddedRelationsPlugin + Admin Generator

2010-09-08 Thread Daniel Lohse
Hey there,

you'll need to set the displayEmptyRelations option to true as described in 
the README. That way, even if there are no embedded relations yet (as in the 
edit view or the add view), the widget Documents exists in the form.


Cheers, Daniel

On 07.09.2010, at 18:44, John Kary wrote:

 I'm using ahDoctrineEasyEmbeddedRelationsPlugin trunk (svn export)
 with symfony 1.4.6 but having a problem displaying the relation when
 using generator.yml.
 
 Everything works great if I do `edit: display: ~` and `new: display:
 ~` in generator.yml. But I am using the `display:` option to order my
 widgets in my form:
 
 edit:
display: [active, slideshow, featured, category_id, speaker,
 speaker_title, title, start_time, end_time, location, special_text,
 description, image_filename, image_alt_text, slideshow_image_filename,
 slideshow_description, Documents, new_Documents]
 #Should be the same as edit: above
 new:
display: [active, slideshow, featured, category_id, speaker,
 speaker_title, title, start_time, end_time, location, special_text,
 description, image_filename, image_alt_text, slideshow_image_filename,
 slideshow_description, Documents, new_Documents]
 
 class EventForm extends BaseEventForm
 {
public function configure()
{
//...
$this-embedRelations(array(
'Documents' = array(
'considerNewFormEmptyFields'= array('filename',
 'description'),
'noNewForm' = false,
'newFormLabel'  = 'New Documents',
'newFormClass'  = 'DocumentForm', //
 Form class to add new objects
//'newFormClassArgs'  =
 array(array('sf_user' = $this-getOption('sf_user'))),
'displayEmptyRelations' = false,
'formClass' =
 'DocumentEmbeddedForm', //Form class to edit existing objects
//'formClassArgs' =
 array(array('ah_add_delete_checkbox' = false, 'another_form_option'
 = '')),
'newFormAfterExistingRelations' = true,
'formFormatter' = null,
'multipleNewForms'  = true,
'newFormsInitialCount'  = 1,
'newFormsContainerForm' = null, // pass
 BaseForm object here or we will create ahNewRelationsContainerForm
'newRelationButtonLabel'= '+ Add Another
 File',
'newRelationAddByCloning'   = true,
'newRelationUseJSFramework' = 'jQuery',
'customEmbeddedFormLabelMethod' = 'getLabelTitle',
),
));
//...
}
 }
 Highlighted version: http://pastebin.com/8UJ3fhSH
 
 To get the `Documents` relation to appear using generator.yml, I must
 add `Documents` to embed the existing relations widget, and
 `new_Documents` to embed the new relation widget.
 
 My problem comes in the edit view when I don't have any existing
 `Documents` relations, symfony gives the error `Widget Documents
 does not exist.`
 
 Is there a way I can use generator.yml to order my widgets and still
 use this plugin? Or is there a different/better approach I can use?
 
 -- 
 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


[symfony-users] ahDoctrineEasyEmbeddedRelationsPlugin + Admin Generator

2010-09-07 Thread John Kary
I'm using ahDoctrineEasyEmbeddedRelationsPlugin trunk (svn export)
with symfony 1.4.6 but having a problem displaying the relation when
using generator.yml.

Everything works great if I do `edit: display: ~` and `new: display:
~` in generator.yml. But I am using the `display:` option to order my
widgets in my form:

edit:
display: [active, slideshow, featured, category_id, speaker,
speaker_title, title, start_time, end_time, location, special_text,
description, image_filename, image_alt_text, slideshow_image_filename,
slideshow_description, Documents, new_Documents]
#Should be the same as edit: above
new:
display: [active, slideshow, featured, category_id, speaker,
speaker_title, title, start_time, end_time, location, special_text,
description, image_filename, image_alt_text, slideshow_image_filename,
slideshow_description, Documents, new_Documents]

class EventForm extends BaseEventForm
{
public function configure()
{
//...
$this-embedRelations(array(
'Documents' = array(
'considerNewFormEmptyFields'= array('filename',
'description'),
'noNewForm' = false,
'newFormLabel'  = 'New Documents',
'newFormClass'  = 'DocumentForm', //
Form class to add new objects
//'newFormClassArgs'  =
array(array('sf_user' = $this-getOption('sf_user'))),
'displayEmptyRelations' = false,
'formClass' =
'DocumentEmbeddedForm', //Form class to edit existing objects
//'formClassArgs' =
array(array('ah_add_delete_checkbox' = false, 'another_form_option'
= '')),
'newFormAfterExistingRelations' = true,
'formFormatter' = null,
'multipleNewForms'  = true,
'newFormsInitialCount'  = 1,
'newFormsContainerForm' = null, // pass
BaseForm object here or we will create ahNewRelationsContainerForm
'newRelationButtonLabel'= '+ Add Another
File',
'newRelationAddByCloning'   = true,
'newRelationUseJSFramework' = 'jQuery',
'customEmbeddedFormLabelMethod' = 'getLabelTitle',
),
));
//...
}
}
Highlighted version: http://pastebin.com/8UJ3fhSH

To get the `Documents` relation to appear using generator.yml, I must
add `Documents` to embed the existing relations widget, and
`new_Documents` to embed the new relation widget.

My problem comes in the edit view when I don't have any existing
`Documents` relations, symfony gives the error `Widget Documents
does not exist.`

Is there a way I can use generator.yml to order my widgets and still
use this plugin? Or is there a different/better approach I can use?

-- 
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] ahDoctrineEasyEmbeddedRelationsPlugin + Admin Generator

2010-09-07 Thread Hugo Briand
I also ran into this problem. I solved it by defining the fields in the form 
class (DocumentsForm in your case).
For the fields I didn't wanted to display, I applied the widget InputHidden.

I'm interested also if there's a better way, this one is not really clean.

Le 7 sept. 2010 à 18:44, John Kary a écrit :

 I'm using ahDoctrineEasyEmbeddedRelationsPlugin trunk (svn export)
 with symfony 1.4.6 but having a problem displaying the relation when
 using generator.yml.
 
 Everything works great if I do `edit: display: ~` and `new: display:
 ~` in generator.yml. But I am using the `display:` option to order my
 widgets in my form:
 
 edit:
display: [active, slideshow, featured, category_id, speaker,
 speaker_title, title, start_time, end_time, location, special_text,
 description, image_filename, image_alt_text, slideshow_image_filename,
 slideshow_description, Documents, new_Documents]
 #Should be the same as edit: above
 new:
display: [active, slideshow, featured, category_id, speaker,
 speaker_title, title, start_time, end_time, location, special_text,
 description, image_filename, image_alt_text, slideshow_image_filename,
 slideshow_description, Documents, new_Documents]
 
 class EventForm extends BaseEventForm
 {
public function configure()
{
//...
$this-embedRelations(array(
'Documents' = array(
'considerNewFormEmptyFields'= array('filename',
 'description'),
'noNewForm' = false,
'newFormLabel'  = 'New Documents',
'newFormClass'  = 'DocumentForm', //
 Form class to add new objects
//'newFormClassArgs'  =
 array(array('sf_user' = $this-getOption('sf_user'))),
'displayEmptyRelations' = false,
'formClass' =
 'DocumentEmbeddedForm', //Form class to edit existing objects
//'formClassArgs' =
 array(array('ah_add_delete_checkbox' = false, 'another_form_option'
 = '')),
'newFormAfterExistingRelations' = true,
'formFormatter' = null,
'multipleNewForms'  = true,
'newFormsInitialCount'  = 1,
'newFormsContainerForm' = null, // pass
 BaseForm object here or we will create ahNewRelationsContainerForm
'newRelationButtonLabel'= '+ Add Another
 File',
'newRelationAddByCloning'   = true,
'newRelationUseJSFramework' = 'jQuery',
'customEmbeddedFormLabelMethod' = 'getLabelTitle',
),
));
//...
}
 }
 Highlighted version: http://pastebin.com/8UJ3fhSH
 
 To get the `Documents` relation to appear using generator.yml, I must
 add `Documents` to embed the existing relations widget, and
 `new_Documents` to embed the new relation widget.
 
 My problem comes in the edit view when I don't have any existing
 `Documents` relations, symfony gives the error `Widget Documents
 does not exist.`
 
 Is there a way I can use generator.yml to order my widgets and still
 use this plugin? Or is there a different/better approach I can use?
 
 -- 
 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