Created
May 8, 2014 09:15
-
-
Save morontt/927cce06603936a36b5c to your computer and use it in GitHub Desktop.
Facepalm (current timestamp)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: morontt | |
* Date: 08.05.14 | |
* Time: 12:15 | |
*/ | |
namespace Ultrasoft\SuperBundle\Controller; | |
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\Response; | |
class GeniusController extends Controller | |
{ | |
/** | |
* @return Response | |
*/ | |
public function indexAction() | |
{ | |
$currentTimestamp = $this->getCurrentTimestamp(); | |
return $this->render( | |
'UltrasoftSuperBundle:Genius:index.html.twig', | |
array( | |
'timestamp' => $currentTimestamp, | |
) | |
); | |
} | |
/** | |
* @return string | |
*/ | |
private function getCurrentTimestamp() | |
{ | |
$em = $this->container->get('doctrine')->getEntityManager(); | |
$rez = $em->getConnection()->fetchAssoc('SELECT CURRENT_TIMESTAMP() as current_datetime;'); | |
return $rez['current_datetime']; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment