sfDoctrineNestedSetPlugin
1.0.0stable
for sf 1.4sf 1.3sf 1.2 and Doctrine
MIT
The sfDoctrineNestedSetPlugin provides additional funcionality to Doctrine's NestedSet behavior. Currently, it adds a widget which formats the nested set according to its hierarchy, and a validator which follows the NestedSet behavior.
Developers
| Name |
Status |
Email |
Hale Sostock |
lead |
moc.liamg <<ta>> kcotsosh
|
License
Copyright (c) 2010 Hale Sostock
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.
sfDoctrineNestedSetPlugin
The sfDoctrineNestedSetPlugin plugin adds a widget and validator to provide
additional functionality to Doctrine's NestedSet behavior.
Installation
Documentation
This plugin contains a widget, sfWidgetFormDoctrineChoiceNestedSet, and validator,
sfValidatorDoctrineNestedSet. For a full explanation with examples (including additional
styling in admin generated forms), please visit:
Implementing a Nested Set.
sfWidgetFormDoctrineChoiceNestedSet
The sfWidgetFormDoctrineChoiceNestedSet functions nearly the same as sfWidgetFormDoctrineChoice,
the only difference being that it will automatically sort the items by their hierarchy, and will
indent each item according to its level. As this widget extends sfWidgetFormDoctrineChoice, it
can be added without any other code changes necessary:
$this->setWidget('item', new sfWidgetFormDoctrineChoiceNestedSet(array(
'model' => 'Category',
'add_empty' => true;
)));
Keep in mind, however, that anything specified for the 'order_by' option will be ignored.
sfValidatorDoctrineNestedSet
The sfValidatorDoctrineNestedSet provides validation by checking that the selected node is not
a descendant of the node passed to it during configuration (and that they are not the same). This
can be used to ensure that when moving a node, it is not made a descendant of itself. The validator
extends from sfValidatorBase and includes two required options: 'model', which is the model class,
and 'node', which is the node that the selected item is being checked against. Normally, this will
be the form's object:
$this->setValidator('item', new sfValidatorDoctrineNestedSet(array(
'model' => 'Category',
'node' => $this->getObject(),
)));
Support
If you run into any issues, or would like to request a feature or contribute, please feel free to
visit halestock.wordpress.com and leave a comment.