Added date actualization possibility
This commit is contained in:
parent
a37904f4ec
commit
488bfa0975
@ -73,6 +73,9 @@ class AdminController extends Controller
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$form->bind($request);
|
||||
if ($form->isValid()) {
|
||||
if ($form->get('updateDate')->getData() == 1) {
|
||||
$post->setCreatedAt(new \DateTime('now'));
|
||||
}
|
||||
$post->setUser($user);
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($post);
|
||||
|
@ -13,6 +13,7 @@ class PostType extends AbstractType
|
||||
$builder
|
||||
->add('title')
|
||||
->add('draft', null, array('required' => false))
|
||||
->add('updateDate', 'checkbox', array('property_path' => false, 'required' => false, 'label' => 'Update creation date'))
|
||||
->add('content', 'ckeditor')
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user