Feat: Implement destination autocompletion by date
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"ext-simplexml": "*",
|
||||
"beberlei/doctrineextensions": "^1.3",
|
||||
"doctrine/doctrine-bundle": "^2.10",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||
"doctrine/orm": "^2.15",
|
||||
|
||||
Generated
+58
-1
@@ -4,8 +4,65 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "51c0d10a5e4bd074ddab5fe5717af560",
|
||||
"content-hash": "9018bf9f3712da46a5f6d428cd540cb0",
|
||||
"packages": [
|
||||
{
|
||||
"name": "beberlei/doctrineextensions",
|
||||
"version": "v1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/beberlei/DoctrineExtensions.git",
|
||||
"reference": "008f162f191584a6c37c03a803f718802ba9dd9a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/008f162f191584a6c37c03a803f718802ba9dd9a",
|
||||
"reference": "008f162f191584a6c37c03a803f718802ba9dd9a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"doctrine/orm": "^2.7",
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.14",
|
||||
"nesbot/carbon": "*",
|
||||
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
|
||||
"symfony/yaml": "^4.2 || ^5.0",
|
||||
"zf1/zend-date": "^1.12",
|
||||
"zf1/zend-registry": "^1.12"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"DoctrineExtensions\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
{
|
||||
"name": "Steve Lacey",
|
||||
"email": "[email protected]"
|
||||
}
|
||||
],
|
||||
"description": "A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.",
|
||||
"keywords": [
|
||||
"database",
|
||||
"doctrine",
|
||||
"orm"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.3.0"
|
||||
},
|
||||
"time": "2020-11-29T07:37:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/cache",
|
||||
"version": "2.2.0",
|
||||
|
||||
@@ -18,7 +18,9 @@ doctrine:
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
|
||||
dql:
|
||||
string_functions:
|
||||
DATE_FORMAT: DoctrineExtensions\Query\Mysql\DateFormat
|
||||
when@test:
|
||||
doctrine:
|
||||
dbal:
|
||||
|
||||
@@ -30,11 +30,12 @@ class DestinationRepository extends ServiceEntityRepository
|
||||
|
||||
$dates = $qb
|
||||
->where($qb->expr()->orX(
|
||||
$qb->expr()->like('destination.product', ':product'),
|
||||
$qb->expr()->like('destination.hotel', ':hotel')
|
||||
$qb->expr()->like('destination.product', ':search'),
|
||||
$qb->expr()->like('destination.hotel', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateFrom, \'%d.%m.%y\')', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateTo, \'%d.%m.%y\')', ':search')
|
||||
))
|
||||
->setParameter('product', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->setParameter('hotel', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->setParameter('search', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->orderBy('destination.dateFrom', 'ASC')
|
||||
->addOrderBy('destination.product', 'ASC')
|
||||
->getQuery()
|
||||
|
||||
Reference in New Issue
Block a user