symfony - Symfony2/Doctrine2-spatial : Class 'Contains' is not defined -
i using https://github.com/djlambert/doctrine2-spatial , have error when trying query "contains" function
firstly, if put :
dql: numeric_functions: contains: creof\spatial\orm\query\ast\functions\mysql\contains
under orm in doc (https://github.com/djlambert/doctrine2-spatial/blob/master/install.md), have error :
[symfony\component\config\definition\exception\invalidconfigurationexception] unrecognized options "dql" under "doctrine.orm"
but if put under doctrine.orm.entity_managers.default there no error still have error when running query, here code :
$sql = 'select demotadbundle:deliveryzone dz contains(dz.area, :point)'; //dz.area of type polygon $converter = new spatialconverter(); $q = $this->_em->createquery($sql)->setparameter('point', $converter->converttodatabasevalue($address->getpoint())); //$address->getpoint returns creof\spatial\php\types\geometry\point object return $q->getoneornullresult();
and here error :
[semantical error] line 0, col 41 near 'contains(dz.area,': error: class 'contains' not defined.
can me resolve problem ?
my symfony version 2.5
thank you.
i resolved problem, seems mixing short , complete syntax, here entire config.yml file (only doctrine section)
i hope :)
doctrine: dbal: driver: "%database_driver%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" user: "%database_user%" password: "%database_password%" charset: utf8 types: geometry: creof\spatial\dbal\types\geometrytype point: creof\spatial\dbal\types\geometry\pointtype polygon: creof\spatial\dbal\types\geometry\polygontype linestring: creof\spatial\dbal\types\geometry\linestringtype orm: auto_generate_proxy_classes: "%kernel.debug%" entity_managers: default: dql: numeric_functions: contains: creof\spatial\orm\query\ast\functions\mysql\contains astext: creof\spatial\orm\query\ast\functions\mysql\astext asbinary: creof\spatial\orm\query\ast\functions\mysql\asbinary geomfromtext: creof\spatial\orm\query\ast\functions\mysql\geomfromtext auto_mapping: true mappings: gedmo_tree: type: annotation prefix: gedmo\tree\entity dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/gedmo/tree/entity" alias: gedmotree # 1 optional , default name set mapping is_bundle: false
Comments
Post a Comment