Inner Join Relation Without Together

hello,

i am trying to filter products by category using a scope and i do that by inner joining the categories

the problem is it only works when i turn together on, which messes up pagination

i recall doing that without a problem

also tried using ‘on’=> instead of ‘condition’=> inside the with() definition, works pretty much the same only the latter is slower db-wise i think

any ideas?


public function category($category=null)

	{

		if ($category) {

			$category = ProductCategory::model()->resetScope()->with('children')->findByPk($category);


			if ($category) {

				$categories = array($category->id);


				if (is_array($category->children)) {

					foreach ($category->children as $child) {

						$categories[] = $child->id;

					}

				}


				$this->getDbCriteria()->mergeWith(array(

					'with'=>array(

						'categories'=>array(

							'condition'=>'categories.id=' . implode($categories, ' or categories.id='),

							'joinType'=>'inner join',

//							'together'=>true,

						),

					),

				));

			}

		}


		return $this;

	}



ps. left joining products on a category is unfortunately not an option

any ideas? i’ ve been searching around about this with no luck… it’s pretty critical to me, any help or direction will be useful…