Compare commits

..

No commits in common. "a129130ba12ba1bdc281351ae7e3de2736f75bef" and "441fdc06b32df8840b0e96efc058eadb9156fb7a" have entirely different histories.

3 changed files with 63 additions and 7 deletions

View file

@ -1,17 +1,15 @@
<?php <?php
declare(strict_types=1);
namespace App\Doctrine\DQL; namespace src\PointToolsBundle\DQL;
use Doctrine\ORM\Query\AST\Functions\FunctionNode; use Doctrine\ORM\Query\AST\Functions\FunctionNode;
use Doctrine\ORM\Query\{Lexer, Parser, SqlWalker}; use Doctrine\ORM\Query\Lexer;
/** TODO: check if still needed */
class Day extends FunctionNode class Day extends FunctionNode
{ {
public $dateExpression; public $dateExpression;
public function parse(Parser $parser): void public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$parser->match(Lexer::T_IDENTIFIER); $parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS); $parser->match(Lexer::T_OPEN_PARENTHESIS);
@ -21,8 +19,8 @@ class Day extends FunctionNode
$parser->match(Lexer::T_CLOSE_PARENTHESIS); $parser->match(Lexer::T_CLOSE_PARENTHESIS);
} }
public function getSql(SqlWalker $sqlWalker): string public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
return 'date_trunc(\'day\', '.$this->dateExpression->dispatch($sqlWalker).')'; return 'date_trunc(\'day\', '.$this->dateExpression->dispatch($sqlWalker).')';
} }
} }

View file

@ -0,0 +1,29 @@
<?php
namespace src\PointToolsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('skobkin_point_tools');
// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
return $treeBuilder;
}
}

View file

@ -0,0 +1,29 @@
<?php
namespace src\PointToolsBundle\DependencyInjection;
use src\PointToolsBundle\DependencyInjection\Configuration;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class SkobkinPointToolsExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}