Symfony 1.4
PHP 5.3.1

I am trying to add some master-detail capabilities to an admin
generated application. I had a look around and installed the
ahDoctrineEasyEmbeddedRelationsPlugin. I followed the readme, and I
quickly got something very similar to what I'd like. Editing and
inserting new details works.

But I do have a problem. If I just edit the master record fields, the
plugin will try to insert one new detail record anyway. I figured I
got something wrong.

In my schema.yml, I have:

[code]
Supplier:
  actAs: { Timestampable: ~ }
  columns:
    ...

Affiliation:
  actAs: { Timestampable: ~ }
  columns:
    supplier_id:
      type:     integer
      notnull:  true
    year:
      type:     integer(4)
      notnull:  true
      unsigned: true
  relations:
    Supplier:   { onDelete: CASCADE , local: supplier_id , foreign:
id , foreignAlias: Affiliations }

Contact:
  actAs: { Timestampable: ~ }
  columns:
    supplier_id:
      type:     integer
      notnull:  true
    type_id:
      type:     integer
      notnull:  true
    number:
      type:     string(50)
      notnull:  true
  relations:
    Supplier:    { onDelete: CASCADE , local: supplier_id , foreign:
id , foreignAlias: Contacts }
    ContactType: { onDelete: RESTRICT, local: type_id     , foreign:
id , foreignAlias: Contacts }
[/code]

In my supplier form I have:
[code]
   public function configure() {
      ...
      $this->embedRelations(array(
          'Contacts' => array(
              'considerNewFormEmptyFields' => array('number')
          )
      ));
      $this->embedRelations(array(
          'Affiliations' => array(
              'considerNewFormEmptyFields' => array('year')
          )
      ));
   }
[/code]

What have I missed? Reading the doc, I was convinced that if the
fields listed in "considerNewFormEmptyFields" were empty, then no
insert would be tried on the db. What happens is that I do get a new
record, with year=0. Should I tweak the model so it doesn't save them,
or is there some option in the plugin that I have missed?

TIA and regards,
Marco Rocci

-- 
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

Reply via email to