CakePHP find not returning correctly - missing model name

☆樱花仙子☆ 提交于 2019-12-02 10:08:42

问题


After performing a find on a model I would expect the result to be of the format

Array
(
    [0] => Array
        (
            [ModelName] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )    
        )
)

However, what I appear to be getting is

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )

        )
)

Note the missing model name.

I've only been getting this problem since migrating across to what appears to be a very poorly configured VPS that I now have full control over.

My problem is, I can't think of anything that would cause this problem. Any ideas greatly appreciated.


回答1:


Turns out to be very similar to this.

Again the problem was with an outdated pdo_mysql version.

This can be checked by running

strings -f pdo_mysql.so | grep ': table'

If there are no results then pdo_mysql is out of date most likely due to an installation such as

pecl install pdo_mysql

My fix was an easy one

yum install php53-mysql

I hope that this helps someone.



来源:https://stackoverflow.com/questions/11960500/cakephp-find-not-returning-correctly-missing-model-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!