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

Comments

Projects
None yet
2 participants
@broneq

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 sergeyklay self-assigned this Jul 19, 2017

@sergeyklay sergeyklay added this to the 3.2.x milestone Jul 19, 2017

@sergeyklay

This comment has been minimized.

Show comment
Hide comment
@sergeyklay

sergeyklay Oct 2, 2017

Member

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

Member

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.

@sergeyklay sergeyklay closed this Oct 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment