Erm, plugin developer here ;-) – 1. You don't need to call embedRelation(); that's called internally by the plugin's embedRelations() method.
2. Calling embedRelation() AND embedForm() AND embedRelations() on the same field names is just wrong – you only need to call embedRelations() once with your array('websites', 'emails', 'telnumbers'), the rest is done for you by the plugin. Now, as for the error: I have no idea why that is (maybe it's going away when following the advice above) and as it's used by 19 people now (or more) that don't report this error I don't know what to tell you right now. You'd have to do some debugging and come up with a possible culprit that's causing this error for you. ;-) Cheers and thanks for using my plugin :) Daniel On 26.05.2010, at 11:28, Ilias Barthelemy wrote: > Hello everyone, > > I'am new to symfony and strugling with the ahDoctrineEasyEmbeddedRelations > plugin. > > I followed the manual on > http://www.symfony-project.org/plugins/ahDoctrineEasyEmbeddedRelationsPlugin > without success (getting error 'Call to undefined method > contactsForm::embedRelations') > Using symfony 1.4.4 & Doctrine 2.2 > > Outline: > > Installed the ahDoctrineEasyEmbeddedRelations using svn > > config/ProjectConfiguration.class.php > > <?php > > require_once dirname(__FILE__).'/../lib/autoload/sfCoreAutoload.class.php'; > sfCoreAutoload::register(); > > class ProjectConfiguration extends sfProjectConfiguration > { > public function setup() > { > > $this->enablePlugins('sfDoctrinePlugin','ahDoctrineEasyEmbeddedRelationsPlugin','sfFormExtraPlugin'); > } > } > ?> > > lib/form/doctrine/BaseFormDoctrine.class.php > > <?php > > abstract class BaseFormDoctrine extends ahBaseFormDoctrine > { > public function setup() > { > } > } > > ?> > > symfony plugin:publish-assets command output: > > >> plugin Configuring plugin - sfDoctrinePlugin > >> plugin Configuring plugin - ahDoctrineEasyEmbeddedRelationsPlugin > >> plugin Configuring plugin - sfFormExtraPlugin > Turu:/var/www/web001# > > > So it seems thath the plugin is working, right ? > > Clear cache ... > ok > > This is my schema: > > contacts: > actAs: { Timestampable: ~ } > columns: > id: { type: integer(9), primary: true, autoincrement: true } > title: { type: enum, notnull: true, values: [Mr, Mrs, Ms, Miss] } > firstName: { type: string(100), notnull: true, minlength: 2 } > lastName: { type: string(100), minlength: 2 } > company: { type: string(100), minlength: 2, unique: true } > addressStreet: { type: string(100), minlength: 2 } > addressNr: { type: string(10) } > adressBus: { type: string(10) } > town: { type: string(10) } > postalCode: { type: string(10) } > remarks: { type: string(2000) } > profession: { type: string(100) } > relations: > websites: > type: many > class: websites > local: id > foreign: contacts_id > onDelete: CASCADE > emails: > type: many > class: emails > local: id > foreign: contacts_id > onDelete: CASCADE > telnumbers: > type: many > class: telnumbers > local: id > foreign: contacts_id > onDelete: CASCADE > > websites: > columns: > id: { type: integer(9), primary: true, autoincrement: true } > url: { type: string(100), notnull: true, unique: true, regexp: > '(http|https)://([\w-]+\.)+(/[\w- ./?%&=]*)?' } > type: { type: enum, notnull: true, values: [work,private,secure] } > contacts_id: { type: integer(9) } > > emails: > columns: > id: { type: integer(9), primary: true, autoincrement: true } > email: { type: string(100), notnull: true, unique: true, minlength: 10 } > type: { type: enum, notnull: true, values: [work,private] } > contacts_id: { type: integer(9) } > > telnumbers: > columns: > id: { type: integer(9), primary: true, autoincrement: true } > number: { type: string(100), notnull: true, unique: true, minlength: 10 } > type: { type: enum, notnull: true, values: [work,home,mobile,fax] } > contacts_id: { type: integer(9) } > > > This is the generator.yml > > generator: > class: sfDoctrineGenerator > param: > model_class: contacts > theme: admin > non_verbose_templates: true > with_show: false > singular: ~ > plural: ~ > route_prefix: contacts > with_doctrine_route: true > actions_base_class: sfActions > > config: > actions: ~ > fields: > title: { label: Title } > firstName: { label: First name } > lastName: { label: Last name } > company: { label: Company } > addressStreet: { label: Street } > addressNr: { label: Nr } > adressBus: { label: Bus } > town: { label: Town } > postalCode: { label: Postal code } > remarks: { label: Remarks } > profession: { label: Profession } > list: > layout: stacked > title: Contact Management > display: [firstName, lastName, company, profession] > sort: [created_at, desc] > max_per_page: 10 > filter: > display: [title, firstName, lastName, company, profession, > addressStreet, town, postalCode, created_at, updated_at] > form: > display: ~ > edit: > title: Editing Contact "%%firstName%%" "%%lastName%%" > new: > title: New contact > > > And here we have the form class: > > <?php > class contactsForm extends BasecontactsForm > { > public function configure() > { > > unset($this['created_at'], $this['updated_at']); > $this->embedRelation('websites'); > $this->embedRelation('emails'); > $this->embedRelation('telnumbers'); > > $this->embedForm('websites', new websitesForm()); > $this->embedForm('emails', new emailsForm()); > $this->embedForm('telnumbers', new telnumbersForm()); > > $this->embedRelations(array( > 'websites' => array( > 'considerNewFormEmptyFields' => array('url', 'type') > ))); > > > /*$this->embedRelations(array( > 'websites' => array( > 'considerNewFormEmptyFields' => array('url'), > 'noNewForm' => false, > 'newFormLabel' => 'New website', > 'newFormClass' => 'websitesForm', > 'newFormClassArgs' => array(), > 'displayEmptyRelations' => false, > 'formClass' => 'websitesForm', > 'formClassArgs' => array(), > 'newFormAfterExistingRelations' => true, > 'formFormatter' => null, > 'multipleNewForms' => true, > 'newFormsInitialCount' => 2, > 'newFormsContainerForm' => null, // pass BaseForm object here > or we will create ahNewRelationsContainerForm > 'newRelationButtonLabel' => '+', > 'newRelationAddByCloning' => true, > 'newRelationUseJSFramework' => 'jQuery' > )));*/ > > > } > } > ?> > > It seems like Symfony doesn't auto include the plug-in class. > > Please help me out here guys , help would be much appreciated. > > Thanks Firemonkey -- 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