Render element when database is Mongodb

Hi all

I have a problem when use Mongodb, for exmaple I have a collection(model) look like

    <?php

    namespace Zphalcon\Models;

    class Province extends ModelBase
    {
        public $id;

        public $name;

        public $nameEn;

        public $nameGoogle;

    }

And collection Province when running Shell db.province.find();

{ "_id" : 1, "name" : "Hà Nội", "nameGoogle" : "Hà Nội", "nameEn" : "Ha Noi" }
{ "_id" : 2, "name" : "Hồ Chí Minh", "nameGoogle" : "Hồ Chí Minh", "nameEn" : "Ho Chi Minh" }
{ "_id" : 3, "name" : "Đà Nẵng", "nameGoogle" : "Đà Nẵng", "nameEn" : "Da Nang" }
{ "_id" : 4, "name" : "Khánh Hòa", "nameGoogle" : "Khánh Hòa", "nameEn" : "Khanh Hoa" }
{ "_id" : 5, "name" : "An Giang", "nameGoogle" : "An Giang", "nameEn" : "An Giang" }
{ "_id" : 6, "name" : "Vũng Tàu", "nameGoogle" : "Vung Tau", "nameEn" : "Vung Tau" }

Then in Form I used such as like http://docs.phalconphp.com/en/latest/reference/forms.html#initializing-forms

    [...]
    $this->add(new Select('province', Province::find(), array(
            'using' => array('nameEn','name')

     )));

Then I was recicive error

Catchable fatal error: Object of class Zphalcon\Models\Province could not be converted to string in /usr/share/nginx/html/master/apps/frontend/cache/volt/_usr_share_nginx_html
_master_apps_frontend_views_post_item.volt.php on line 79

If I use database is Mysql it will working. This is bug or not feauture MongoDb

Could you please paste here a dump of Province::find() it's looks like it returns not array of object, but just single object.



36.3k

@m1ome

Here result when dump

Array
(
    [0] => Zphalcon\Models\Province Object
        (
            [id] => 
            [name] => Hà Nội
            [nameGoogle] => Hà Nội
            [nameEn] => Ha Noi
            [_id] => 1
            [_dependencyInjector:protected] => Phalcon\DI\FactoryDefault Object
                (
                    [_services] => Array
                        (
                            [router] => Phalcon\DI\Service Object
                                (
                                    [_name] => router
                                    [_definition] => Closure Object
                                        (
                                        )

                                    [_sharedInstance] => Phalcon\Mvc\Router Object
                                        (
                                            [_dependencyInjector:protected] => Phalcon\DI\FactoryDefault Object
 *RECURSION*
                                            [_uriSource:protected] => 
                                            [_namespace:protected] => Zphalcon\Frontend\Controllers
                                            [_module:protected] => frontend
                                            [_controller:protected] => test
                                            [_action:protected] =>

@Thien

Can you do a same dump when you are using MySQL?

@Thien, it's seems like a bug.