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

Assigning EWKT to type #188

Open
yurtesen opened this issue Dec 5, 2017 · 0 comments
Open

Assigning EWKT to type #188

yurtesen opened this issue Dec 5, 2017 · 0 comments

Comments

@yurtesen
Copy link

yurtesen commented Dec 5, 2017

If I have a 'geopoint' column, but I access it using SQL with something like SELECT ST_AsEWKT(coords) as coords and I will get the EWKT text, how can I parese it to a Point() object?

I came up with something like below, but I am guessing this is not the right way?:

    $sql = "SELECT st.id,st.name,ST_AsEWKT(coords) as coords FROM store st LIMIT 1";
    $conn = $this->getEntityManager()->getConnection();
    $stmt = $conn->prepare($sql);
    $stmt->execute();
    $result = $stmt->fetchAll();
    $parser = new PostgreSql();
    $point = $parser->convertStringToPHPValue(AbstractSpatialType::getType('geopoint'),$result[0]['coords']);
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

1 participant