findall bug since 2012?


(Saludes 86) #1

Hi!

I was trying to do a right join in a findAll and I get 0 results. Using the YiiDegubToolbar, Copying the SQL generated and paste into my Oracle DataBase I get 3 results. This has no sense.

I founded this

https://code.google.com/archive/p/yii/issues/3222

If Yii 1.1.19 (latest), If I change CActiveFinder.php line 824


if(isset($row[$this->_pkAlias]))

to


if(isset($row[$this->_pkAlias]) || is_null($row[$this->_pkAlias]))

it "works" relative.

This is the code that I run:


$model = User::model()->with(array('idOrgs'=>array("joinType"=>"RIGHT JOIN")))->findAll();

relation:


'idOrgs' => array(self::HAS_MANY, 'Organizations', array('ID_ORGS' => 'ID_USER_ORGS')),

Thanks and regards!