bajzany / sorting-entity
Entity sorting extension
Installs: 464
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:extensions
Requires
- php: ^7.2
- nette/application: ^2.4
- nette/bootstrap: ^2.4
- nette/di: ^2.4
This package is auto-updated.
Last update: 2024-10-29 05:11:03 UTC
README
Instalation
-
Composer installation
composer require bajzany/sorting-entity dev-master
-
Registration into extension .neon
extensions: sortingEntity: Bajzany\SortingEntity\DI\SortingEntityExtension
-
For integration into entity use
repositoryClass="Bundles\Page\Repository\PageRepository" implements ISortingEntity use Sortable;
Example:
/**
* @ORM\Table(name="page_pages")
* @ORM\Entity(
* repositoryClass="Bundles\Page\Repository\PageRepository"
* )
*/
class Page implements ISortingEntity
{
use Identifier;
use Sortable;
......
another properity
}
Repository important functions:
- getSorted($parent = NULL, bool $compareParent = FALSE, $getQueryBuilder = FALSE)
- moveUp(ISortingEntity $entity, ISortingEntity $target)
- moveDown(ISortingEntity $entity, ISortingEntity $target)
getSorted
-
getSorted entities. Options:
parent = you can set parentId where you can sorted compareParent = for enabling parent sorting (because parent can be null) getQueryBuilder = now return updated queryBuilder, this option has been good for another filtering data or for another Components whitch want QueryBuilder
moveUp
- Move entity over target entity
moveDown
- Move entity under target entity