PHP code example of xepozz / sorter-bundle
1. Go to this page and download the library: Download xepozz/sorter-bundle library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
xepozz / sorter-bundle example snippets
use Doctrine \ORM \Mapping as ORM ;
class OrderListItem
{
public function getId () { }
public function setId () { }
public function getSort () { }
public function setSort () { }
public function getSuperCategories () { }
}
use Symfony \Bundle \FrameworkBundle \Controller \Controller ;
use Xepozz \EntitySorterBundle \Utils \EntitySorter ;
class TestController extends Controller
{
private $entitySorter;
public function __construct (EntitySorter $entitySorter)
{
$this ->entitySorter = $entitySorter;
}
public function moveUpAction (OrderListItem $entity)
{
$this ->entitySorter->moveUp($entity);
return $this ->redirect('...' );
}
public function moveDownAction (OrderListItem $entity)
{
$this ->entitySorter->moveDown($entity);
return $this ->redirect('...' );
}
}
use Doctrine \ORM \Mapping as ORM ;use Xepozz \EntitySorterBundle \Model \BaseSort ;
class ProductSubCategory extends BaseSort
{
protected $productCategory;
public function getSuperCategories ()
{
return ['productCategory' => $this ->getProductCategory()];
}
}
return [
'productCategory' => $this ->getProductCategory(),
'anotherSuperCategory' => $this ->getAnotherSuperCategory()
];