Okay I have found my error... :)

It was in the schema.yml :

edsDimensionsLiterie:
  inheritance:
    extends: edsDimensionsLL
    type: column_aggregation
    keyField: object_class
    keyValue: edsDimensionsLiterie
  columns:
    literie_id:
      type: integer(4)
  relations:
    literie:
      class: edsProduitLiterie
      local: literie_id
      foreign: id
      type: one
      foreignType: many
      foreignAlias: dimensions
      owningSide: false

Before Printing, Think about Your Environmental Responsibility!
Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!


On Thu, Apr 8, 2010 at 6:25 PM, Stéphane <stephane.er...@gmail.com> wrote:

> Hi,
>
> I'm on a new project, I've installed the new version of the plugin.
>
> //part of schema
> edsProduitLiterieSommier:
>   inheritance:
>     extends: edsProduitLiterie
>     type: column_aggregation
>     keyField: object_class
>     keyValue: edsProduitLiterieSommier
>
> edsDimensionsLiterie:
>   inheritance:
>     extends: edsDimensionsLL
>     type: column_aggregation
>     keyField: object_class
>     keyValue: edsDimensionsLiterie
>   columns:
>     literie_id:
>       type: integer(4)
>   relations:
>     literie:
>       class: edsProduitLiterie
>       local: id
>       foreign: id
>       type: one
>       foreignType: many
>       foreignAlias: dimensions
>       owningSide: false
>
> //in the edsProduitLiterieForm class
>          /**
>  * @see edsProduitForm
>  */
>  public function configure()
> {
> parent::configure();
>  if( !$this->isNew() )
> {
> $this->embedRelations(
>  array('dimensions'=>array(
> 'opposite'=>'literie', // << see latest part of this email
>  'newFormLabel'=>'Add new Dimension',
> 'considerNewFormEmptyFields'=>'prix',
>  )));
> }
> }
>
> Then I can create an edsProduitLiterieSommier but when sf returns me the
> edit form, its form's action is not good :
> <form action="*/backend_dev.php/produits/literies/sommiers/*"
> method="post"><input type="hidden" value="put" name="sf_method">    <input
> type="hidden" id="eds_produit_literie_sommier_id" value="1"
> name="eds_produit_literie_sommier[id]"><input type="hidden"
> id="eds_produit_literie_sommier__csrf_token"
> value="0a21cbf700ce672a39a4c6ccf2f6872b"
> name="eds_produit_literie_sommier[_csrf_token]">
>     ....
>
> And when I comment the embedRelations in the edsProduitLiterieForm, it
> comes all good again :
> <form method="post"
> action="/backend_dev.php/produits/literies/sommiers/1"><input type="hidden"
> name="sf_method" value="put" />
>
> This line is written by the template _form.php @line 5:
> <?php echo form_tag_for($form, '@eds_produit_literie_sommier') ?>
>
> I really don't understand what's going wrong with this.
>
> Anyone can help me ??
>
> Thanks !!!
>
>
>
> Anyway, I have managed to change a few things :
>
> -the way it is coded to link the related object to the context object is
> not clear to me as it uses the get_class instead of the real relation name.
> I've changed the code to look like this:
> if (Doctrine_Relation::MANY === $relation->getType())
>           {
>             $newFormObjectClass = $relation->getClass();
>             $newFormObject = new $newFormObjectClass();
>             $newFormObject[$relations[$relationName]['opposite']] =
> $this->getObject();
>           } else
>           {
>             $newFormObject = $this->getObject()->$relationName;
>           }
>
> Then in the embedRelations array I add a "opposite" to tell which opposite
> relation to use to link objects. I didn't been able to "guess" the
> foreignAlias from either sides.
>
> -In the doBind method, I have managed to add this code:
>
> @line 140
> "
> $identifier =
> $this->getObject()->getTable()->getRelation($relationName)->getTable()->getIdentifier();
> if(isset($relationValues['delete_object']) && $relationValues[$identifier])
> "
> Before, it was 'id' which is not very versatile. I think it does the job in
> almost all cases (except when identifier is an array), I didn't managed the
> errors
>
>
>
>
> Before Printing, Think about Your Environmental Responsibility!
> Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale!
>

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to