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

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to