Skip to content

model->findFirstBy... doesn't work with columnMap() in Oracle  #10490

Closed
@skaosYan

Description

Hi,

Phalcon 2.0.2, Oracle 12c.

I have set columnMap() for my model.
Then, I invoke find on my model like this:
Users::findFirstByEmail('test@test.com');

In SQL debug.log I see:

[Tue, 09 Jun 15 02:58:38 +0300][INFO] SELECT COUNT() "numrows" FROM (SELECT * FROM (SELECT Z1., ROWNUM PHALCON_RN FROM (SELECT USERS.USERID, USERS.NAME, USERS.EMAIL, USERS.PASSWORD, USERS.MUSTCHANGEPASSWORD, USERS.PROFILESID, USERS.SEX, USERS.PHONE, USERS.BIRTHDATE FROM USERS WHERE USERS.EMAIL = :0) Z1 WHERE ROWNUM <= 1))

But the call itself results in error:

Column 'PHALCON_RN' doesn't make part of the column map
#0 [internal function]: Phalcon\Mvc\Model::cloneResultMap(Object(Vokuro\Models\Users), Array, Array, 0, false)

#1 [internal function]: Phalcon\Mvc\Model\Resultset\Simple->current()

#2 [internal function]: Phalcon\Mvc\Model\Resultset->getFirst()

#3 [internal function]: Phalcon\Mvc\Model\Query->execute(Array, NULL)

#4 [internal function]: Phalcon\Mvc\Model::findFirst(Array)

#5 /home/var/www/html/v1/app/controllers/UsersController.php(93): Phalcon\Mvc\Model::__callStatic('findFirstByEmai...', Array)

#6 /home/var/www/html/v1/app/controllers/UsersController.php(93): Vokuro\Models\Users::findFirstByEmail('test@test.ru')

#7 [internal function]: Vokuro\Controllers\UsersController->createAction()

#8 [internal function]: Phalcon\Dispatcher->dispatch()

#9 /home/var/www/html/v1/public/index.php(41): Phalcon\Mvc\Application->handle()

How this bug can be fixed?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions