martin-georgiev / postgresql-for-doctrine

PostgreSQL enhancements for Doctrine. Provides support for advanced data types (json, jssnb, arrays), text search, array operators and jsonb specific functions.
https://packagist.org/packages/martin-georgiev/postgresql-for-doctrine
MIT License
364 stars 44 forks source link

Error with symfony and dql ilke function #159

Closed jubaron closed 10 months ago

jubaron commented 1 year ago

I'm not sure it's an issue. But when I try to use your bundle with symfony 4.4. and the ILIKE function like this :

entity_managers:
            client:
                class_metadata_factory_name: Doctrine\ORM\Mapping\ClassMetadataFactory
                default_repository_class: Doctrine\ORM\EntityRepository
                quote_strategy: doctrine.orm.quote_strategy.default
                entity_listener_resolver: null
                repository_factory: doctrine.orm.container_repository_factory
                hydrators: {  }
                filters: {  }
                naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
                auto_mapping: true
                connection: dbalclient
                mappings:
                    Client:
                        is_bundle: false
                        type: annotation
                        dir: '%kernel.project_dir%/src/Entity/Client'
                        prefix: 'App\Entity\Client'
                        alias: Client
                dql:
                    string_functions:
                        ILIKE: MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\Ilike

In my controller :

$clientRepository = $this->emc->getRepository(Client::class);
            /** @var ORMQueryBuilder */
            $searchQuery = $clientRepository->createQueryBuilder('c');
            $searchQuery->select('partial c.{id}');
                if (isset($name)) {
            $searchQuery->andWhere('ILIKE(c.name, :name) = TRUE');
                    $searchQuery->setParameter('name', $nom);
        }

I got this error :


<!-- It's a requirement to specify a Metadata Driver and pass it to Doctrine\ORM\Configuration::setMetadataDriverImpl(). (500 Internal Server Error) -->
martin-georgiev commented 10 months ago

I'm afraid Symfony 4.4 is not among this package's supported versions anymore.