cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: Find offset lcase

Open niden opened this issue 3 years ago • 0 comments

I tried find() and it worked. Specifying properties outside the table in columns may be a "don't do", but the results I get seem strange. Even if I didn't specify it, I thought that the fully qualified namespaced class name would be set as the key, but the first letter was lowercase. Is this normal?

$result = \App\Models\Users::find([
    'conditions' => 'phase>0',
    'columns' => '*, "ready" AS stat'
]);
var_dump($result[0]['stat']);    // ready
var_dump(result[0]->offsetGet(\App\Models\Users::class)->name);    // Warning: Uncaught Phalcon\Mvc\Model\Exception: The index does not exist in the row in phalcon/Mvc/Model/Row.zep:42 Stack trace: ~
var_dump(result[0]->offsetGet(lcfirst(\App\Models\Users::class))->name);    // string 'John Doe'

Originally posted by @s-ohnishi in https://github.com/phalcon/cphalcon/discussions/16048#discussioncomment-3359215

niden avatar Aug 10 '22 13:08 niden