Added date actualization possibility

This commit is contained in:
Gergely POLONKAI (W00d5t0ck) 2012-09-15 23:33:31 +02:00
parent a37904f4ec
commit 488bfa0975
2 changed files with 4 additions and 0 deletions

View File

@ -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);

View File

@ -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')
;
}