Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with getRelated with columns provided when they are initialised in relation params #12972

Closed
broneq opened this issue Jul 19, 2017 · 1 comment
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@broneq
Copy link

broneq commented Jul 19, 2017

Expected and Actual Behavior

Actualy when I have defined some relation like:

$this->belongsTo(
            'robots_id',
            'Store\Toys\Robots',
            'id',
            [
                'alias' => 'Robots',
                'params' => [
                    'columns' => 'id,name'
                ]
            ]
        );

And ask for

$model->getRobots() 

in result I have two columns id and name, and its expected result.

But if i as for:

$model->getRobots(['columns'=>'id,price,name'])

in result I have again two columns without price.

I think that is a bug in https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/manager.zep#L1307

let builder = this->createBuilder(this->_mergeFindParameters(extraParameters, parameters));

we are overwriting relation parameters on provided parameters...
It's suprising that in https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/manager.zep#L1364 it''s reverse logic.

Details

  • Phalcon version: 3.1.2
  • PHP Version: 7.1.4
  • Operating System: Ubuntu 14.04.1 LTS
  • Installation type: installing via package manager
  • Server: Nginx
  • Other related info (Database, table schema): PostgreSQL 9.5.5
    --
    Przemek
@sergeyklay
Copy link
Contributor

sergeyklay commented Oct 2, 2017

Fixed in the 3.2.x branch. Feel free to open a new issue if the problem appears again. Thank you for contributing.

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

3 participants