Compare commits

...

2 Commits

Author SHA1 Message Date
Alexey Skobkin a129130ba1
Removed DependencyInjection dir from old code due to uselessness. 2023-03-28 23:02:58 +03:00
Alexey Skobkin 2029adc48d
Ported Day DQL extension. 2023-03-28 23:01:56 +03:00
3 changed files with 7 additions and 63 deletions

View File

@ -1,29 +0,0 @@
<?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

@ -1,29 +0,0 @@
<?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');
}
}

View File

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