Get data by sql Postgres Postgis

I’m trying to get data form spacial db. I use


 SELECT gid, ST_X(geom), ST_Y(geom), ST_AsText(geom) 

       FROM rv;

to get points data (and give readable lat/lon) in pgAdmin.

How can I get the same data using yii. I have tried


$posts = Yii::$app->db->createCommand('SELECT gid, ST_X(geom), ST_Y(geom), ST_AsText(geom) 

       FROM rv')

            ->queryAll();

But i do not get anything. Suggetions???

I’ve tested it on my side.

The function (MySQL):




DELIMITER //


CREATE FUNCTION GETFULLNAME(fname CHAR(250),lname CHAR(250))

    RETURNS CHAR(250)

    BEGIN

        DECLARE fullname CHAR(250);

        SET fullname=CONCAT(fname,' ',lname);

        RETURN fullname;

    END //


DELIMITER ;



The call:




$posts = Yii::$app->db->createCommand('select GETFULLNAME(name,photo) from test_table')->queryAll();

var_dump($posts);



The result:




/var/www/html/orzd/controllers/SiteController.php:68:

array (size=1)

  0 => 

    array (size=1)

      'GETFULLNAME(name,photo)' => string 'test2 test1' (length=11)



I am aware yoy have been using Postgres. Nevertheless check it twice. Maybe you have mistaken something.

It was a mistake. I was getting correct data, but I was not able to see data in the current view. I created a new view with just print print_r and echo functions to verify data I was getting. Thank you.

Cool! :)