![]() |
|
csDoctrineActAsSortablePlugin - 1.5.3bshaffer |
|
![]() |
79
users
Sign-in
to change your status |
bshaffer |
This plugin has moved to github! https://github.com/bshaffer/csDoctrineActAsSortablePlugin
The csDoctrineActAsSortablePlugin is a symfony plugin that allows use of the doctrine behavior actAsSortable.
This behavior provides methods on your model for setting display order/position.
This plugin also contains images to implement for ordering.
Original Dev Sponsored By Centre{source} interactive agency
Maintenance Sponsored By echoditto labs
| Name | Status | |
|---|---|---|
|
|
lead | moc.liamg <<ta>> sfahsb |
| Version | License | API | Released |
|---|---|---|---|
| 1.5.4.1stable | MIT license | 1.5.0stable | 20/05/2011 |
| 1.5.3stable | MIT license | 1.5.0stable | 17/04/2011 |
| 1.5.1stable | MIT license | 1.5.1stable | 20/09/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.5.4.1stable | MIT license | 1.5.0stable | 20/05/2011 |
| 1.5.3stable | MIT license | 1.5.0stable | 17/04/2011 |
| 1.5.1stable | MIT license | 1.5.1stable | 20/09/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.5.4.1stable | MIT license | 1.5.0stable | 20/05/2011 |
| 1.5.3stable | MIT license | 1.5.0stable | 17/04/2011 |
| 1.5.1stable | MIT license | 1.5.1stable | 20/09/2010 |
| 1.0.3stable | MIT license | 1.0.3stable | 10/07/2009 |
| 1.0.1stable | MIT license | 1.0.1stable | 26/04/2009 |
| Version | License | API | Released |
|---|---|---|---|
| 1.5.1stable | MIT license | 1.5.1stable | 20/09/2010 |
| 1.0.3stable | MIT license | 1.0.3stable | 10/07/2009 |
| 1.0.1stable | MIT license | 1.0.1stable | 26/04/2009 |
| 1.0.0stable | MIT license | 1.0.0stable | 24/04/2009 |
Array
Array
Array
Array
Updating Symfony versions and adding Brent Shaffer as a Developer.
The csDoctrineActAsSortablePlugin is a symfony plugin that allows use of the doctrine behavior actAsSortable.
This behavior provides methods on your model for setting display order/position.
This plugin also contains images to implement for ordering.
git submodule add git://github.com/bshaffer/csDoctrineActAsSortablePlugin.git plugins/csDoctrineActAsSortablePlugin
git submodule init
git submodule update
svn propedit svn:externals plugins
In the editor that's displayed, add the following entry and then save
csDoctrineActAsSortablePlugin https://svn.github.com/bshaffer/csDoctrineActAsSortablePlugin.git
Finally, update:
svn up
In your config/ProjectConfiguration.class.php file, make sure you have
the plugin enabled.
$this->enablePlugins('csDoctrineActAsSortablePlugin');
Apply the behavior to your model in your schema file config/doctrine/schema.yml
MyModel:
actAs: [Sortable]
Optionally accepts a UniqueBy attribute which will be used on a model with a one-to-many relationship
MyModel:
actAs:
Sortable:
uniqueBy: [parent_id]
Rebuild your models and database
./symfony doctrine:build --all --and-load
Publish your assets
./symfony plugin:publish-assets
Clear your cache
./symfony cc
promote
$record->promote();
demote
$record->demote();
moveToFirst
$record->moveToFirst();
moveToLast
$record->moveToLast();
moveToPosition
$record->moveToPosition($newPosition);
sort - accepts the array created by the symfony/prototype sortableElement tag
Doctrine::getTable('MyModel')->sort($order);
findAllSorted - Accepts sort order (asc, desc)
Doctrine::getTable('Model')->findAllSorted('asc');
findAllSortedWithParent - accepts the parent column name, the value, and sort order (asc, desc)
Doctrine::getTable('MyModel')->findAllSortedWithParent($fk_value, $fk_name, 'asc');
In your module, edit config/generator.yml, and under list, object actions, add:
object_actions:
promote:
action: promote
demote:
action: demote
_edit: -
_delete: -
In your module, edit actions/actions.class.php, Add the following actions:
public function executePromote()
{
$object=Doctrine::getTable('MyModel')->findOneById($this->getRequestParameter('id'));
$object->promote();
$this->redirect("@moduleIndexRoute");
}
public function executeDemote()
{
$object=Doctrine::getTable('MyModel')->findOneById($this->getRequestParameter('id'));
$object->demote();
$this->redirect("@moduleIndexRoute");
}
