add batch action
This commit is contained in:
parent
b839f4df0b
commit
e0b4206778
|
@ -20,6 +20,7 @@ use Symfony\Component\HttpFoundation\Session\Session;
|
|||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Form\Form;
|
||||
use App\Core\Entity\EntityInterface;
|
||||
use App\Entity\Blog\Post;
|
||||
|
||||
/**
|
||||
* @Route("/admin/blog/post")
|
||||
|
@ -84,6 +85,12 @@ class PostAdminController extends CrudController
|
|||
->setBatchAction('index', 'delete', 'Delete', function(EntityInterface $entity, EntityManager $manager) {
|
||||
$manager->delete($entity);
|
||||
})
|
||||
->setBatchAction('index', 'draft', 'Publier', function(EntityInterface $entity, EntityManager $manager) {
|
||||
$manager->update($entity->setStatus(Post::DRAFT));
|
||||
})
|
||||
->setBatchAction('index', 'publish', 'En brouillon', function(EntityInterface $entity, EntityManager $manager) {
|
||||
$manager->update($entity->setStatus(Post::PUBLISHED));
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue