Using Yii 1.1.8 with Oracle 10g2
Can’t get pagination working correctly when CDbCriteria->together = true.
When I set together = true, all the filters work, but the pagination does not.
Setting together to null, false or not setting it at all, results in a working pagination, but filtering the data causes an "invalid identifier" SQL error to occur.
I have been browsing around online for an answer to this, but have been unsuccessful. Any ideas or "right direction" pointing is appreciated. If I am leaving anything important out, please let me know and I will do my best to include it.
The code I included below is for a class called ParcelLink and has a HAS_MANY relationship with "parcel". There is only one "parcel" per ParcelLink per year, and I am filtering on the year. Also, "PARCEL_NUMBER" is the only field I am using within the search that is owned directly by ParcelLink. Each of the related fields have setters and getters within the ParcelLink model.
public function search()
{
$criteria=new CDbCriteria;
$criteria->with = array(
'parcel',
'parcel.city',
'parcel.taxDistrict',
'parcel.businessNames',
'parcel.section',
'parcel.subdivision',
'parcel.section.township',
'currentOwnerInterests.ownerExemptions',
'currentOwnerInterests.ownerName',
);
$criteria->together = true;
$criteria->compare('"t".PARCEL_NUMBER', $this->PARCEL_NUMBER, true);
$criteria->compare('"parcel".HOUSE_NUMBER', $this->houseNumber, true);
$criteria->compare('"parcel".PREFIX_DIRECTION', $this->streetDir, true);
$criteria->compare('"parcel".STREET', $this->streetName, true);
$criteria->compare('"parcel".STREET_TYPE', $this->streetType, true);
$criteria->compare('"parcel".SUFFIX_DIRECTION', $this->streetSuffixDir,
true);
$criteria->compare('"parcel".UNIT', $this->streetUnit, true);
$criteria->compare('"parcel".LEGAL_DESCRIPTION',
$this->legalDescription, true);
$criteria->compare('"subdivision".SUBDIVISION_CODE', $this->subdivision,
false);
$criteria->compare('"section".SECTION_NUMBER', $this->section,
false);
$criteria->compare('"township".TOWNSHIP',
$this->township, false);
$criteria->compare('"township".RANGE_',
$this->range, false);
$criteria->compare('"currentOwnerInterests"."ownerName".OWNER_NAME',
$this->ownerName, true);
$criteria->compare('"currentOwnerInterests"."ownerName".ADDRESS1',
$this->ownerAddress1, true);
$criteria->compare('"currentOwnerInterests"."ownerName".ADDRESS2',
$this->ownerAddress2, true);
$criteria->compare('"currentOwnerInterests"."ownerName".CITY',
$this->ownerCity, true);
$criteria->compare('"currentOwnerInterests"."ownerName".STATE',
$this->ownerState, true);
$criteria->compare('"currentOwnerInterests"."ownerName".ZIP',
$this->ownerZip, true);
$criteria->compare('"currentOwnerInterests"."ownerName".ZIP4',
$this->ownerZip4, true);
$criteria->compare('"currentOwnerInterests"."ownerName".OWNER_NUMBER',
$this->ownerNumber, false);
$criteria->compare('"parcel"."city".CITY_CODE', $this->cityCode, true);
$criteria->compare('"parcel"."taxDistrict".TAX_DIST_NAME',
$this->taxDistrictCode, false);
$criteria->compare('"currentOwnerInterests"."ownerExemptions".EXEMPT_CODE',
$this->homestead, true);
$criteria->compare('"parcel"."businessNames".BUSINESS_NAME',
$this->businessName, true);
return new CActiveDataProvider(get_class($this), array(
'criteria' => $criteria,
'sort'=>array(
'defaultOrder'=>'"t".PARCEL_NUMBER ASC',
),
'pagination' => array(
'pageSize' => 20,
),
));
}
I was going to link a screenshot of the search page, but I am not allowed to embed links in the forum at this time.