Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-up problem #3

Closed
maxthev opened this issue Jul 23, 2015 · 14 comments
Closed

Set-up problem #3

maxthev opened this issue Jul 23, 2015 · 14 comments

Comments

@maxthev
Copy link

maxthev commented Jul 23, 2015

Hi ! i'm trying to use your doctrine-postgis extension but i have some trouble.

the "installation" part is ok, but then you said :

**All you have to do is, to register an event subscriber.**
use Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber;
$entityManager->getEventManager()->addEventSubscriber(new ORMSchemaEventSubscriber());

I don't understand where to put this or what i need to do with this.

Thanks
https://github.com/jsor/doctrine-postgis/issues/new#fullscreen

@jsor
Copy link
Owner

jsor commented Jul 23, 2015

This depends on how you use and setup Doctrine. Are you using it with Symfony or any other framework?

@maxthev
Copy link
Author

maxthev commented Jul 23, 2015

Symfony, with config in yml.

@jsor
Copy link
Owner

jsor commented Jul 23, 2015

See http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html

Your config would be something like:

services:
    doctrine_postgis_subscriber_default:
        class: Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber
        tags:
            - { name: doctrine.event_subscriber, connection: default }

@maxthev
Copy link
Author

maxthev commented Jul 23, 2015

I created the service, but in don't see any differences.

in my database table, i have some column :

(....other column....)
coordinates_point POINT,
coordinates GEOGRAPHY(POINT,4326),
(....other columns....)

I don't understand how to use them with doctrine, doctrine don't want my "point",

**[Doctrine\DBAL\DBALException]
  Unknown database type point requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.**

i tried to update my entities like this :

/**
     * @var point
     *
     * @ORM\Column(name="coordinates_point", type="point", nullable=true)
     */

TO

/**
     * @var geometry
     *
     * @ORM\Column(name="coordinates_point", type="geometry", options={"geometry_type"="POINT"}, nullable=true)
     */

and then doctrine:schema:update, but it's the same error...

@jsor
Copy link
Owner

jsor commented Jul 23, 2015

This error occures while DBAL inspects your database and don't have a DBAL type for the POINT column. You need to change the column type manually in your database.

@maxthev
Copy link
Author

maxthev commented Jul 23, 2015

it's seems it beginning to work, thank's a lot !

@jsor
Copy link
Owner

jsor commented Jul 23, 2015

Glad to hear. Let me know how it goes :)
I'm closing this for now, feel free to reopen if needed.

@jsor jsor closed this as completed Jul 23, 2015
@maxthev
Copy link
Author

maxthev commented Jul 23, 2015

yoooops to late x) i don't know how to 're-open', guess i will juste write another comment here ?

now i have :

 [Doctrine\DBAL\DBALException]
  Unknown database type geometry requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it.

looks like "geography" works well but "geometry" does not ...

@jsor
Copy link
Owner

jsor commented Jul 23, 2015

Hmm...can you try to register the DBAL type manually:

doctrine:
    dbal:
        types:
            geometry: Jsor\Doctrine\PostGIS\Types\GeometryType

@jsor jsor reopened this Jul 23, 2015
@maxthev
Copy link
Author

maxthev commented Jul 24, 2015

Lol, today it works well without doing anything x) maybe it was a cache problem or something like this.

Thanks you a lot anyway !

@jsor
Copy link
Owner

jsor commented Jul 24, 2015

Yeah, cache probably. Glad it works now. Let me know if have any other questions or problems.

@jsor jsor closed this as completed Jul 24, 2015
@delphimat
Copy link

A little message to say that this post is still usefull in 2016. Thanks #jsor

@jsor
Copy link
Owner

jsor commented Jan 14, 2016

These little messages are written in seconds and give motivation for days. Thanks and a happy new year!

@angelocavallet
Copy link

angelocavallet commented Jul 15, 2016

Hello!
Please, any ideia how setup this in ZF2?
I already have require the package with composer but i don't know how to setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants