Hi guys,

I think Daniel Lohse did a great job on
ahDoctrineEasyEmbeddedRelations plugin:
http://www.symfony-project.org/plugins/ahDoctrineEasyEmbeddedRelationsPlugin/1_3_4

But I encounter some problems. When I do the same, I have got
exception like:

<Unknown record property / related component "FileFolder" on "File">

I think the plugin is fail to get father's alias

This is an example, in one to many relationship, let's say:

FileFolder:
  actAs: ...
  columns: ...

File:
  actAs: ...
  columns: ...
  relations:
    Folder:
      class:           FileFolder
      foreignAlias:  Papers
      type:             one
      foreignType:  many
      onDelete:      CASCADE

$file = new File();
$file->Folder; // work!
$file->FileFolder; // fail, since we have a custom alias name in
schema

I traced down this problem in ahBaseFormDoctrine class:

  private function embeddedFormObjectFactory($relationName,
Doctrine_Relation $relation)
  {
    if (Doctrine_Relation::MANY === $relation->getType())
    {
      $newFormObjectClass = $relation->getClass();
      $newFormObject = new $newFormObjectClass();
      $newFormObject[get_class($this->getObject())] = $this-
>getObject();         // get father's alias by using get_class($this-
>getObject()), then we get FileFolder but not Folder !
    } else
    {
      $newFormObject = $this->getObject()->$relationName;
    }

    return $newFormObject;
  }

Because I cannot see there is a setting I could pass in embedRations
method, soI have created a patch for it:
http://gist.github.com/417043

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