Copyright (c) 2O08 ISICS.fr
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Installation for sf 1.2
php symfony plugin:install isicsPropelNestedSetPositionPlugin --release=0.9.5
Installation for sf 1.1
php symfony plugin:install isicsPropelNestedSetPositionPlugin --release=0.9.5
PEAR
Download the PEAR package
Repository
Go to the repository: http://svn.symfony-project.com/plugins/isicsPropelNestedSetPositionPlugin
isicsPropelNestedSetPosition plugin
This plugins adds a widget and a valitor for easily handle your Propel nested set objects position.
Installation
Usage
In your sfFormPropel class:
use the widget isicsWigetFormPropelNestedSetPosition:
$this->setWidgets(array(
'position' => new isicsWigetFormPropelNestedSetPosition(array('node' => $this->object))
));
use the validator isicsValidatorPropelNestedSetPosition:
$this->setValidators(array(
'position' => new isicsValidatorPropelNestedSetPosition(array('node' => $this->object, 'max_depth' => 3))
));
max_depth option is optionnal.
customize the doSave() method:
public function doSave($con = null)
{
if (!is_null($position = $this->getValue('position')))
{
$this->object->$position['method']($position['related_node']);
}
parent::doSave($con);
}
I18N: by default, methods translations have to be in "messages" catalogue.
You can specify any catalogue in app.yml:
isics_widget_form_propel_nested_set_position:
i18n_catalogue: my_catalogue
By default, a new node is added as last child of root. You're also able to define another default method and related node:
$this->setWidgets(array(
'position' => new isicsWigetFormPropelNestedSetPosition(array(
'node' => $this->object,
'default_method' => 'insertAsFirstChildOf',
'default_related_node' => my_parent_node->getId()
))
));
ROADMAP