Skip to content

Commit

Permalink
Added support SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Dec 31, 2022
1 parent 297c9e6 commit bf5b5ad
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Features
What was changed in this fork?
-----------------------------
- Disable anonymously access, registrations, spam/antispam, added ACL permissions.
- Support MySQL and PostgresSQL.
- Support MySQL, PostgresSQL or SQLite.
- Removed HWIOBundle, Algolia, GoogleAnalytics and other not used dependencies.

Table of content
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@
},
"autoload": {
"psr-4": {
"Packeton\\": "src/"
"Packeton\\": "src/",
"Oro\\": "doctrine/"
}
},
"replace": {
Expand Down
21 changes: 21 additions & 0 deletions doctrine/ORM/Query/AST/Platform/Functions/Sqlite/Month.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Oro\ORM\Query\AST\Platform\Functions\Sqlite;

use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\SqlWalker;
use Oro\ORM\Query\AST\Functions\SimpleFunction;
use Oro\ORM\Query\AST\Platform\Functions\PlatformFunctionNode;

class Month extends PlatformFunctionNode
{
public function getSql(SqlWalker $sqlWalker): string
{
/** @var Node $expression */
$expression = $this->parameters[SimpleFunction::PARAMETER_KEY];

return "STRFTIME('%m', " . $this->getExpressionValue($expression, $sqlWalker) . ")";
}
}
21 changes: 21 additions & 0 deletions doctrine/ORM/Query/AST/Platform/Functions/Sqlite/Year.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Oro\ORM\Query\AST\Platform\Functions\Sqlite;

use Doctrine\ORM\Query\AST\Node;
use Doctrine\ORM\Query\SqlWalker;
use Oro\ORM\Query\AST\Functions\SimpleFunction;
use Oro\ORM\Query\AST\Platform\Functions\PlatformFunctionNode;

class Year extends PlatformFunctionNode
{
public function getSql(SqlWalker $sqlWalker): string
{
/** @var Node $expression */
$expression = $this->parameters[SimpleFunction::PARAMETER_KEY];

return "STRFTIME('%Y', " . $this->getExpressionValue($expression, $sqlWalker) . ")";
}
}
5 changes: 3 additions & 2 deletions src/Controller/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Pagerfanta\Doctrine\ORM\QueryAdapter;
use Pagerfanta\Pagerfanta;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -57,7 +58,7 @@ public function createAction(Request $request)
$group = new Group();
$data = $this->handleUpdate($request, $group, 'Group has been saved successfully');

return $this->render('group/update.html.twig', $data);
return $data instanceof Response ? $data : $this->render('group/update.html.twig', $data);
}

/**
Expand All @@ -71,7 +72,7 @@ public function updateAction(Request $request, #[Vars] Group $group)
{
$data = $this->handleUpdate($request, $group, 'Group has been saved successfully');

return $this->render('group/update.html.twig', $data);
return $data instanceof Response ? $data : $this->render('group/update.html.twig', $data);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Model/MaintainerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Packeton\Form\Model;

use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\Security\Core\User\UserInterface;

class MaintainerRequest
{
Expand Down

0 comments on commit bf5b5ad

Please sign in to comment.