如何使用Dql获取2个日期之间的差异?
我尝试了以下代码,但是没有用.
$query =$this->_em->createQuery('select a,DATEDIFF(d,\'now\',a.date) from ABundle:Abonment a where d==1');
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
我无法stof/doctrine-extensions-bundle使用我的Composer进行安装.我正在使用Symfony2.1.9版本,并显示了很多问题.第一个是:
找不到请求的包stof/doctrine-extensions-bundle 1.1.*.
这是我的composer.json档案:
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.5-dev",
"doctrine/doctrine-bundle": "1.1.*",
"twig/extensions": "1.0.*@dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*@dev",
"pagerfanta/pagerfanta": "dev-master",
"white-october/pagerfanta-bundle": "dev-master",
"friendsofsymfony/user-bundle": "dev-master",
"saad-tazi/g-chart-bundle": "dev-master",
"stof/doctrine-extensions-bundle": "1.1.*",
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", …Run Code Online (Sandbox Code Playgroud)