Author: annis
Date: 2010-04-27 13:43:23 +0200 (Tue, 27 Apr 2010)
New Revision: 29269
Modified:
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/README
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/TODO
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/lib/form/ahBaseFormDoctrine.class.php
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/package.xml
Log:
Merge branch 'master' into HEAD
Conflicts:
README
lib/form/ahBaseFormDoctrine.class.php
package.xml
Modified: plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/README
===================================================================
--- plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/README 2010-04-27
09:20:48 UTC (rev 29268)
+++ plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/README 2010-04-27
11:43:23 UTC (rev 29269)
@@ -11,45 +11,45 @@
symfony plugin:install ahDoctrineEasyEmbeddedRelationsPlugin
* Install the plugin (via a Subversion checkout)
-
+
svn co
http://svn.symfony-project.com/plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk
plugins/ahDoctrineEasyEmbeddedRelationsPlugin
* Install the plugin (via a Git clone)
-
+
git clone
git://github.com/annismckenzie/ahDoctrineEasyEmbeddedRelationsPlugin.git
* Activate the plugin in `config/ProjectConfiguration.class.php`
-
+
[php]
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins(array(
- 'sfDoctrinePlugin',
+ 'sfDoctrinePlugin',
'ahDoctrineEasyEmbeddedRelationsPlugin',
'...'
));
}
}
-
+
* Change the parent class in `lib/form/doctrine/BaseFormDoctrine.class.php`
to `ahBaseFormDoctrine `
-
+
[php]
abstract class BaseFormDoctrine extends ahBaseFormDoctrine
{
...
}
-
+
* Clear your cache
-
+
symfony cc
## Embedding relations ##
Here is an example schema definition:
-
+
[yml]
ahIntranetSubversionRepository:
actAs:
@@ -75,13 +75,15 @@
'Repositories' => array(
'considerNewFormEmptyFields' => array('name', 'repo_path',
'repo_username', 'repo_password'),
'noNewForm' => true,
- 'newFormLabel' => 'New repository!!!',
+ 'newFormLabel' => 'New repository!!!',
'newFormClass' =>
'ahIntranetSubversionRepositoryNewForm',
'newFormClassArgs' => array(array('sf_user' =>
$this->getOption('sf_user'))),
'displayEmptyRelations' => false,
'formClass' =>
'ahIntranetSubversionRepositoryEmbeddedForm',
'formClassArgs' =>
array(array('ah_add_delete_checkbox' => false, 'another_form_option' => ...)),
- 'newFormAfterExistingRelations' => false
+ 'newFormAfterExistingRelations' => false,
+ 'multipleNewForms' => true,
+ 'newFormsInitialCount' => 2,
),
'...' => array(
...
@@ -96,7 +98,7 @@
Each array defines one embedded relation and you can define a handful of
options.
* The minimal code is this:
-
+
[php]
public function configure()
{
@@ -115,17 +117,17 @@
* `considerNewFormEmptyFields` (the only required option, array): trouble
starts when the user does not want to add a new related object but only wants
to edit the main object's properties.
As the embedded forms are validated, an error is thrown if one of the
embedded form's field's is required.
To remedy that you'll have to add all the fields to this array and if all
of these are empty (read: only works for text fields for now), the empty form
is dropped and no empty object is saved to the database (or validation errors
thrown).
-
+
* `noNewForm` (boolean, not required): if false, no empty form to add a new
related object is embedded so you can only manage existing related objects.
-
+
* `newFormLabel` (string, not required): the label that is shown for the new
embedded form. If the form is used in the admin generator, label definitions in
the generator.yml take precedence over this option:
-
+
[yml]
generator:
...
param:
...
-
+
config:
actions: ~
fields:
@@ -134,37 +136,37 @@
label: New repository
list:
...
-
+
The key to use in the fields array above is 'new_relationName'
('new_Repositories' in this case, see the example above).
-
+
* `newFormClass` (string, not required): the form class to use for the empty
form
-
+
* `newFormClassArgs` (array of arrays, not required): form class options to
pass to the empty form class on instantiation.
Explanation for why it's an array of arrays: the way embedRelation works
uses reflection to construct the right form objects. Now, the first argument is
always the model object, the second is the form option array and the third is
the local CSRF secret for the form.
You don't need to worry about the first one (the model object) because
this is always null for the new form. If you want to pass some more options to
the related form object (like the user object to avoid using sfContext) just
follow the example above.
I could have changed this (because I implemented it) but I don't want to
confuse the developer because when you look at the option `formClassArgs` below
it's the same mechanism and I can't change that short of copying the whole
embedRelation method over to the ahBaseFormDoctrine class, thereby losing the
chance to automatically get upstream bugfixes. :)
-
+
* `formClass` (string, not required): the form class to use for the existing
related objects.
-
+
* `formClassArgs` (array of arrays, not required): form class options to
pass to the existing related objects form class on instantiation
As of version 1.1 it's not necessary to create a separate form class for
the existing related forms to display the delete checkbox.
This is now handled by the symfony event dispatcher. If you want to change
how that works you can always copy over this method and change it to suit your
needs:
-
+
[php]
public function listenToFormPostConfigureEvent(sfEvent $event)
{
$form = $event->getSubject();
-
+
if($form instanceof sfFormDoctrine &&
$form->getOption('ah_add_delete_checkbox', false) && !$form->isNew())
{
$form->setWidget('delete_object', new
sfWidgetFormInputCheckbox(array('label' => 'Just destroy the damn object!')));
$form->setValidator('delete_object', new sfValidatorPass());
}
}
-
+
Or if you're like me and want to save space, here's another version you
can use:
-
- [php]
+
+ [php]
public function listenToFormPostConfigureEvent(sfEvent $event)
{
if ($form = parent::listenToFormPostConfigureEvent($event))
@@ -172,17 +174,21 @@
$form->widgetSchema['delete_object']->setOption('label', 'Just
destroy the damn object!');
}
}
-
+
This works because we're calling the plugin's event handler method.
This either returns the form so it added the delete checkbox and the
validator and you can act on that, or it returns false and you don't act on
that. Neat and tidy. :)
-
+
* `displayEmptyRelations` (boolean, not required): set this option to true
(false is the default) if you want to check for existing related objects
yourself. This can be done in the form template and is useful if you want to
let the user know that 'There are no related repositories yet.'. The default is
just not displaying anything in this case, which works for me. :)
-
+
* `newFormAfterExistingRelations` (boolean, not required): set this option
to true to display the empty form to add new related objects below the existing
related objects
+ * `multipleNewForms` (boolean, not required): set this option to true if you
want to have multiple new related object forms
+
+ * `newFormsInitialCount`: (integer, not required, default: 1): number of new
object forms initially displayed (you may insert/delete those forms dynamically
using JavaScript, all submitted subforms will be processed and validated.)
+
## Questions, bugs, feature requests? ##
I can be reached via e-mail: [email protected]
-If you find bugs, have questions and/or feature requests, you can post to the
symfony-user mailing list,
-of which I am an avid follower. :)
\ No newline at end of file
+If you find bugs, have questions and/or feature requests, you can post to the
symfony-user mailing list,
+of which I am an avid follower. :)
Modified: plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/TODO
===================================================================
--- plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/TODO 2010-04-27
09:20:48 UTC (rev 29268)
+++ plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/TODO 2010-04-27
11:43:23 UTC (rev 29269)
@@ -1,6 +1,6 @@
# TODO #
-## Version 1.3 ##
+## Version 1.4 ##
* try improving and abstracting the functionality to ignore empty "add
new" forms so this does not have
to be managed in the embedding form class anymore
Modified:
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/lib/form/ahBaseFormDoctrine.class.php
===================================================================
---
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/lib/form/ahBaseFormDoctrine.class.php
2010-04-27 09:20:48 UTC (rev 29268)
+++
plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/lib/form/ahBaseFormDoctrine.class.php
2010-04-27 11:43:23 UTC (rev 29269)
@@ -5,70 +5,56 @@
*
* @package ahDoctrineEasyEmbeddedRelationsPlugin
* @subpackage form
- * @author Daniel Lohse, Steve Guhr <[email protected]>
+ * @author Daniel Lohse, Steve Guhr <[email protected]>, Krzysztof
Kotowicz <kkotowicz at gmail dot com>
*/
abstract class ahBaseFormDoctrine extends sfFormDoctrine
{
protected
$scheduledForDeletion = array(), // related objects scheduled for deletion
$embedRelations = array(); // so we can check which relations are
embedded in this form
-
+
public function embedRelations(array $relations)
{
$this->embedRelations = $relations;
-
+
$this->getEventDispatcher()->connect('form.post_configure', array($this,
'listenToFormPostConfigureEvent'));
-
- foreach (array_keys($relations) as $relationName)
+
+ foreach ($relations as $relationName => $relationSettings)
{
$relation = $this->getObject()->getTable()->getRelation($relationName);
- if (!isset($relations[$relationName]['noNewForm']) ||
!$relations[$relationName]['noNewForm'])
+ if (!isset($relationSettings['noNewForm']) ||
!$relationSettings['noNewForm'])
{
if (($relation->isOneToOne() &&
!$this->getObject()->relatedExists($relationName)) || !$relation->isOneToOne())
{
- $formClass = !isset($relations[$relationName]['newFormClass']) ?
$relation->getClass().'Form' : $relations[$relationName]['newFormClass'];
- $formArgs = !isset($relations[$relationName]['newFormClassArgs']) ?
array() : $relations[$relationName]['newFormClassArgs'];
- $r = new ReflectionClass($formClass);
-
- //sfContext::getInstance()->getLogger()->info($relation);
-
- if (Doctrine_Relation::MANY === $relation->getType())
+ $formLabel = isset($relationSettings['newFormLabel']) ?
$relationSettings['newFormLabel'] : null;
+ if (!empty($relationSettings['multipleNewForms'])) // allow multiple
new forms for this relation
{
- $newFormObjectClass = $relation->getClass();
- $newFormObject = new $newFormObjectClass();
- $newFormObject[get_class($this->getObject())] = $this->getObject();
- } else
- {
- $newFormObject = $this->getObject()->$relationName;
+
+ $newFormsCount = !empty($relationSettings['newFormsInitialCount'])
? $relationSettings['newFormsInitialCount'] : 1;
+
+ $subForm = new sfForm();
+ unset($subForm[sfForm::$CSRFFieldName]);
+ for ($i = 0; $i < $newFormsCount; $i++)
+ {
+ // we need to create new forms with cloned object inside
(otherwise only the last new values would be saved)
+ $newForm = $this->embeddedFormFactory($relationName,
$relationSettings, $relation, $i + 1);
+ $subForm->embedForm($i, $newForm);
+ }
+ $subForm->getWidgetSchema()->setLabel($formLabel);
+ $this->embedForm('new_'.$relationName, $subForm);
}
-
- $newForm = $r->newInstanceArgs(array_merge(array($newFormObject),
array($formArgs)));
- $newFormIdentifiers =
$newForm->getObject()->getTable()->getIdentifierColumnNames();
- foreach ($newFormIdentifiers as $primaryKey)
+ else // just a single new form for this relation
{
- unset($newForm[$primaryKey]);
+ $newForm = $this->embeddedFormFactory($relationName,
$relationSettings, $relation, $formLabel);
+ $this->embedForm('new_'.$relationName, $newForm);
}
- unset($newForm[$relation->getForeignColumnName()]);
-
- // FIXME/TODO: check if this even works for one-to-one
- // CORRECTION 1: Not really, it creates another record but doesn't
link it to this object!
- // CORRECTION 2: No, it can't, silly! For that to work the id of the
not-yet-existant related record would have to be known...
- // Think about overriding the save method and after calling
parent::save($con) we should update the relations that:
- // 1. are one-to-one AND
- // 2. are LocalKey :)
- if (isset($relations[$relationName]['newFormLabel']))
- {
-
$newForm->getWidgetSchema()->setLabel($relations[$relationName]['newFormLabel']);
- }
-
- $this->embedForm('new_'.$relationName, $newForm);
}
}
-
- $formClass = !isset($relations[$relationName]['formClass']) ? null :
$relations[$relationName]['formClass'];
- $formArgs =
array_merge((!isset($relations[$relationName]['formClassArgs']) ? array() :
$relations[$relationName]['formClassArgs']),
array(array('ah_add_delete_checkbox' => true)));
+
+ $formClass = !isset($relationSettings['formClass']) ? null :
$relationSettings['formClass'];
+ $formArgs = array_merge((!isset($relationSettings['formClassArgs']) ?
array() : $relationSettings['formClassArgs']),
array(array('ah_add_delete_checkbox' => true)));
$this->embedRelation($relationName, $formClass, $formArgs);
-
+
/*
* Unset the relation form(s) if:
* (1. One-to-many relation and there are no related objects yet (count
of embedded forms is 0) OR
@@ -80,40 +66,40 @@
(
((!$relation->isOneToOne()) &&
(count($this->getEmbeddedForm($relationName)->getEmbeddedForms()) === 0)) ||
($relation->isOneToOne() &&
$this->getEmbeddedForm($relationName)->isNew())
- ) &&
- (!isset($relations[$relationName]['displayEmptyRelations']) ||
!$relations[$relationName]['displayEmptyRelations'])
+ ) &&
+ (!isset($relationSettings['displayEmptyRelations']) ||
!$relationSettings['displayEmptyRelations'])
)
{
unset($this[$relationName]);
}
-
+
if (
- isset($relations[$relationName]['newFormAfterExistingRelations']) &&
$relations[$relationName]['newFormAfterExistingRelations'] &&
+ isset($relationSettings['newFormAfterExistingRelations']) &&
$relationSettings['newFormAfterExistingRelations'] &&
isset($this[$relationName]) && isset($this['new_'.$relationName])
)
{
$this->getWidgetSchema()->moveField('new_'.$relationName,
sfWidgetFormSchema::AFTER, $relationName);
}
}
-
+
$this->getEventDispatcher()->disconnect('form.post_configure',
array($this, 'listenToFormPostConfigureEvent'));
}
-
+
public function listenToFormPostConfigureEvent(sfEvent $event)
{
$form = $event->getSubject();
-
+
if($form instanceof sfFormDoctrine &&
$form->getOption('ah_add_delete_checkbox', false) && !$form->isNew())
{
$form->setWidget('delete_object', new
sfWidgetFormInputCheckbox(array('label' => 'Delete')));
$form->setValidator('delete_object', new sfValidatorPass());
-
+
return $form;
}
-
+
return false;
}
-
+
/**
* Here we just drop the embedded creation forms if no value has been
provided for them (this simulates a non-required embedded form),
* please provide the fields for the related embedded form in the call to
$this->embedRelations() so we don't throw validation errors
@@ -127,25 +113,64 @@
{
if (!isset($keys['noNewForm']) || !$keys['noNewForm'])
{
- if (isset($keys['considerNewFormEmptyFields']) &&
count($keys['considerNewFormEmptyFields']) > 0 &&
isset($values['new_'.$relationName]))
+ $containerName = 'new_'.$relationName;
+
+ if (!empty($keys['multipleNewForms'])) // just a single new form for
this relation
{
- $emptyFields = 0;
- foreach ($keys['considerNewFormEmptyFields'] as $key)
+ if (array_key_exists($containerName, $values))
{
- if ('' === trim($values['new_'.$relationName][$key])) {
- $emptyFields++;
- } elseif (is_array($values['new_'.$relationName][$key]) &&
count($values['new_'.$relationName][$key]) === 0) {
- $emptyFields++;
+ foreach ($values[$containerName] as $index => $subFormValues)
+ {
+ if ($this->isNewFormEmpty($subFormValues, $keys))
+ {
+ unset($values[$containerName][$index],
$this->embeddedForms[$containerName][$index]);
+ unset($this->validatorSchema[$containerName][$index]);
+ }
+ else
+ {
+ // if new forms were inserted client-side, embed them here
+ if (!isset($this->embeddedForms[$containerName][$index]))
+ {
+ // create and embed new form
+ $relation =
$this->getObject()->getTable()->getRelation($relationName);
+ $addedForm = $this->embeddedFormFactory($relationName,
$keys, $relation, ((int) $index) + 1);
+ $ef = $this->embeddedForms[$containerName];
+ $ef->embedForm($index, $addedForm);
+ // .. and reset other stuff (symfony loses all this since
container form is already embedded)
+ $this->validatorSchema[$containerName] =
$ef->getValidatorSchema();
+ $this->widgetSchema[$containerName] = new
sfWidgetFormSchemaDecorator($ef->getWidgetSchema(),
$ef->getWidgetSchema()->getFormFormatter()->getDecoratorFormat());
+ $this->setDefault($containerName, $ef->getDefaults());
+ }
+ }
}
}
-
- if ($emptyFields === count($keys['considerNewFormEmptyFields'])) {
- //sfContext::getInstance()->getLogger()->info('Dropping relation
:'.$relationName);
- unset($values['new_'.$relationName], $this['new_'.$relationName]);
+
+ $this->validatorSchema[$containerName] =
$this->embeddedForms[$containerName]->getValidatorSchema();
+
+ // check for new forms that were deleted client-side and never
submitted
+ foreach
(array_keys($this->embeddedForms[$containerName]->embeddedForms) as $index)
+ {
+ if (!array_key_exists($index, $values[$containerName]))
+ {
+ unset($this->embeddedForms[$containerName][$index]);
+ unset($this->validatorSchema[$containerName][$index]);
+ }
}
+
+ if (empty($values[$containerName])) // all new forms were empty
+ {
+ unset($values[$containerName], $this[$containerName]);
+ }
}
+ else
+ {
+ if (!array_key_exists($containerName, $values) ||
$this->isNewFormEmpty($values[$containerName], $keys))
+ {
+ unset($values[$containerName], $this[$containerName]);
+ }
+ }
}
-
+
if (isset($values[$relationName]))
{
$oneToOneRelationFix =
$this->getObject()->getTable()->getRelation($relationName)->isOneToOne() ?
array($values[$relationName]) : $values[$relationName];
@@ -158,10 +183,9 @@
}
}
}
-
parent::doBind($values);
}
-
+
/**
* Updates object with provided values, dealing with eventual relation
deletion
*
@@ -176,34 +200,38 @@
$relation = $this->getObject()->getTable()->getRelation($relationName);
foreach ($ids as $index => $id)
{
- if ($relation->isOneToOne()) {
+ if ($relation->isOneToOne())
+ {
unset($values[$relationName]);
}
- else {
+ else
+ {
unset($values[$relationName][$index]);
}
-
- if (!$relation->isOneToOne()) {
+
+ if (!$relation->isOneToOne())
+ {
unset($this->object[$relationName][$index]);
}
- else {
+ else
+ {
$this->object->clearRelated($relationName);
}
-
+
Doctrine::getTable($relation->getClass())->findOneById($id)->delete();
}
}
}
-
+
parent::doUpdateObject($values);
}
-
+
/**
* Saves embedded form objects.
* TODO: Check if it's possible to use embedRelations in one form and and
also use embedRelations in the embedded form!
* This means this would be possible:
- * 1. Edit a user object via the userForm and
- * 2. Embed the groups relation (user-has-many-groups) into the
groupsForm and embed that into userForm and
+ * 1. Edit a user object via the userForm and
+ * 2. Embed the groups relation (user-has-many-groups) into the
groupsForm and embed that into userForm and
* 2. Embed the permissions relation (group-has-many-permissions)
into the groupsForm and
* 3. Just for kinks, embed the permissions relation again
(user-has-many-permissions) into the userForm
*
@@ -216,21 +244,21 @@
{
if (null === $con) $con = $this->getConnection();
if (null === $forms) $forms = $this->getEmbeddedForms();
-
+
foreach ($forms as $form)
{
if ($form instanceof sfFormObject)
{
- /**
- * we know it's a form but we don't know what (embedded) relation it
represents;
- * this is necessary because we only care about the relations that
we(!) embedded
+ /**
+ * we know it's a form but we don't know what (embedded) relation it
represents;
+ * this is necessary because we only care about the relations that
we(!) embedded
* so there isn't anything weird happening
*/
$relationName = $this->getRelationByEmbeddedFormClass($form);
-
+
//sfContext::getInstance()->getLogger()->info(print_r($this->scheduledForDeletion,
true));
//sfContext::getInstance()->getLogger()->info($relationName);
-
+
if (!$relationName ||
!isset($this->scheduledForDeletion[$relationName]) || ($relationName &&
!array_key_exists($form->getObject()->getId(),
array_flip($this->scheduledForDeletion[$relationName]))))
{
$form->saveEmbeddedForms($con);
@@ -243,7 +271,7 @@
}
}
}
-
+
/**
* Get the used relation alias when given an embedded form
*
@@ -258,7 +286,97 @@
return $relation->getAlias();
}
}
+
+ return false;
+ }
+
+ /**
+ * Checks if given form values for new form are 'empty' (i.e. should the
form be discarded)
+ * @param array $values
+ * @param array $keys settings for the embedded relation
+ * @return bool
+ */
+ protected function isNewFormEmpty(array $values, array $keys)
+ {
+ if (!isset($keys['considerNewFormEmptyFields']) ||
count($keys['considerNewFormEmptyFields']) == 0 || !isset($values)) return
false;
+
+ $emptyFields = 0;
+ foreach ($keys['considerNewFormEmptyFields'] as $key)
+ {
+ if ('' === trim($values[$key]))
+ {
+ $emptyFields++;
+ }
+ elseif (is_array($values[$key]) && count($values[$key]) === 0)
+ {
+ $emptyFields++;
+ }
+ }
+
+ if ($emptyFields === count($keys['considerNewFormEmptyFields']))
+ {
+ return true;
+ }
return false;
}
+
+ /**
+ * Creates and initializes new form object for a given relation.
+ * @internal
+ * @param string $relationName
+ * @param array $relationSettings
+ * @param Doctrine_Relation $relation
+ * @param string $formLabel
+ * @return sfFormDoctrine
+ */
+ private function embeddedFormFactory($relationName, array $relationSettings,
Doctrine_Relation $relation, $formLabel = null)
+ {
+ $newFormObject = $this->embeddedFormObjectFactory($relationName,
$relation);
+ $formClass = !isset($relationSettings['newFormClass']) ?
$relation->getClass().'Form' : $relationSettings['newFormClass'];
+ $formArgs = !isset($relationSettings['newFormClassArgs']) ? array() :
$relationSettings['newFormClassArgs'];
+ $r = new ReflectionClass($formClass);
+
+ $newForm = $r->newInstanceArgs(array_merge(array($newFormObject),
array($formArgs)));
+ $newFormIdentifiers =
$newForm->getObject()->getTable()->getIdentifierColumnNames();
+ foreach ($newFormIdentifiers as $primaryKey)
+ {
+ unset($newForm[$primaryKey]);
+ }
+ unset($newForm[$relation->getForeignColumnName()]);
+
+ // FIXME/TODO: check if this even works for one-to-one
+ // CORRECTION 1: Not really, it creates another record but doesn't link
it to this object!
+ // CORRECTION 2: No, it can't, silly! For that to work the id of the
not-yet-existant related record would have to be known...
+ // Think about overriding the save method and after calling
parent::save($con) we should update the relations that:
+ // 1. are one-to-one AND
+ // 2. are LocalKey :)
+ if (!is_null($formLabel))
+ {
+ $newForm->getWidgetSchema()->setLabel($formLabel);
+ }
+
+ return $newForm;
+ }
+
+ /**
+ * Returns Doctrine Record object prepared for form given the relation
+ * @param string $relationName
+ * @param Doctrine_Relation $relation
+ * @return Doctrine_Record
+ */
+ 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();
+ } else
+ {
+ $newFormObject = $this->getObject()->$relationName;
+ }
+
+ return $newFormObject;
+ }
}
Modified: plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/package.xml
===================================================================
--- plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/package.xml
2010-04-27 09:20:48 UTC (rev 29268)
+++ plugins/ahDoctrineEasyEmbeddedRelationsPlugin/trunk/package.xml
2010-04-27 11:43:23 UTC (rev 29269)
@@ -10,9 +10,9 @@
<email>[email protected]</email>
<active>yes</active>
</lead>
- <date>2010-03-31</date>
+ <date>2010-04-27</date>
<version>
- <release>1.2.4</release>
+ <release>1.3.0</release>
<api>1.0.0</api>
</version>
<stability>
@@ -162,5 +162,26 @@
Because of an error, there was no "real" release version 1.2.3, there
is a tag for it in the Subversion repository but nothing more. :)
</notes>
</release>
+ <release>
+ <version>
+ <release>1.3.0</release>
+ <api>1.0.0</api>
+ </version>
+ <stability>
+ <release>stable</release>
+ <api>stable</api>
+ </stability>
+ <license uri="http://www.symfony-project.com/license">MIT
license</license>
+ <date>2010-04-27</date>
+ <license>MIT</license>
+ <notes>
+ Thanks to koto (on GitHub) the whole workhorse class has been
refactored into more manageable parts! :)
+
+ - in addition to this koto has been kind enough to add the ability to
add multiple new objects in one go, which he also documented in the README
+ - add to that the ability to add new forms dynamically with JavaScript
(think of rendering a partial with the "Add form" inside via AJAX) and you'll
know that this rightfully deserved a minor version number increase!
+
+ Thank you koto!
+ </notes>
+ </release>
</changelog>
</package>
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.