Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This patch file was generated by NetBeans IDE
- # It uses platform neutral UTF-8 encoding and \n newlines.
- --- ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
- +++ ahDoctrineEasyEmbeddedRelationsPlugin/lib/form/ahBaseFormDoctrine.class.php
- @@ -30,7 +30,8 @@
- 'newFormsContainerForm' => null, // pass BaseForm object here or we will create ahNewRelationsContainerForm
- 'newRelationButtonLabel' => '+',
- 'newRelationAddByCloning' => true,
- - 'newRelationUseJSFramework' => 'jQuery'
- + 'newRelationUseJSFramework' => 'jQuery',
- + 'father_key' => null
- );
- protected function addDefaultRelationSettings(array $settings)
- @@ -374,7 +375,7 @@
- */
- private function embeddedFormFactory($relationName, array $relationSettings, Doctrine_Relation $relation, $formLabel = null)
- {
- - $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation);
- + $newFormObject = $this->embeddedFormObjectFactory($relationName, $relation , $relationSettings['father_key']);
- $formClass = empty($relationSettings['newFormClass']) ? $relation->getClass().'Form' : $relationSettings['newFormClass'];
- $formArgs = empty($relationSettings['newFormClassArgs']) ? array() : $relationSettings['newFormClassArgs'];
- $r = new ReflectionClass($formClass);
- @@ -408,13 +409,17 @@
- * @param Doctrine_Relation $relation
- * @return Doctrine_Record
- */
- - private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation)
- + private function embeddedFormObjectFactory($relationName, Doctrine_Relation $relation , $father_key = null)
- {
- if (Doctrine_Relation::MANY === $relation->getType())
- {
- $newFormObjectClass = $relation->getClass();
- $newFormObject = new $newFormObjectClass();
- - $newFormObject[get_class($this->getObject())] = $this->getObject();
- +
- + if(!$father_key){
- + $father_key = get_class($this->getObject());
- + }
- + $newFormObject[$father_key] = $this->getObject();
- } else
- {
- $newFormObject = $this->getObject()->$relationName;
Add Comment
Please, Sign In to add comment