Details
-
Type:
Improvement
-
Status:
In Progress
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.3.1
-
Fix Version/s: None
-
Component/s: None
-
Security Level: All
-
Labels:
Description
The recently added collection filtering API only goes half way in achieving a full fledged solution to filter huge collections. It still lacks joins. Look at the next two snippets:
$criteria = Criteria::create()
->where(Criteria::expr()->eq('storeId', $store->getId()))
->andWhere(Criteria::expr()->eq('Category', 20))
->orderBy(array('popularity' => 'DESC'));
return $this->BrandCategories->matching($criteria);
This piece of code works but what if there is a need to filter the BrandCategories collection by Categories with some extra criteria:
$criteria = Criteria::create()
->where(Criteria::expr()->eq('storeId', $store->getId()))
->andWhere(Criteria::expr()->eq('Category', 20))
->andWhere(Criteria::expr()->eq('Category.name', 'Electronics'))
->orderBy(array('popularity' => 'DESC'));
return $this->BrandCategories->matching($criteria);
That would not work.
Ideally we should have a possibility to join other entities, the Category entity in our case here:
$criteria = Criteria::create()
->where(Criteria::expr()->eq('storeId', $store->getId()))
->andWhere(Criteria::expr()->eq('Category', 20))
->innerJoin(Criteria::expr()->field('Category', 'Category'))
->andWhere(Criteria::expr()->eq('Category.name', 'Electronics'))
->orderBy(array('popularity' => 'DESC'));
return $this->BrandCategories->matching($criteria);
What do you think about it, does it make sense to add such functionality?
Activity
Oleg Namaka
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Description |
The recently added collection filtering API only goes half way in achieving a full fledged solution to filter huge collections. It still lack joins. Look at the next two snippets:
{code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} This piece of code works but what if there is a need to filter the BrandCategories collection by Categories with some extra criteria: {code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->andWhere(Criteria::expr()->eq('Category.name', 'Electronics')) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} That would not work. Ideally we should have a possibility to join other entities, the Category entity in our case here: {code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->innerJoin(Criteria::expr()->field('Category', 'Category')) ->andWhere(Criteria::expr()->eq('Category.name', 'Electronics')) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} What do you think about it, does it make sense to add such functionality? |
The recently added collection filtering API only goes half way in achieving a full fledged solution to filter huge collections. It still lacks joins. Look at the next two snippets:
{code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} This piece of code works but what if there is a need to filter the BrandCategories collection by Categories with some extra criteria: {code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->andWhere(Criteria::expr()->eq('Category.name', 'Electronics')) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} That would not work. Ideally we should have a possibility to join other entities, the Category entity in our case here: {code} $criteria = Criteria::create() ->where(Criteria::expr()->eq('storeId', $store->getId())) ->andWhere(Criteria::expr()->eq('Category', 20)) ->innerJoin(Criteria::expr()->field('Category', 'Category')) ->andWhere(Criteria::expr()->eq('Category.name', 'Electronics')) ->orderBy(array('popularity' => 'DESC')); return $this->BrandCategories->matching($criteria); {code} What do you think about it, does it make sense to add such functionality? |
Oleg Namaka
made changes -
| Status | Open [ 1 ] | Awaiting Feedback [ 10000 ] |
Oleg Namaka
made changes -
| Labels | api collection filtering |
Oleg Namaka
made changes -
| Status | Awaiting Feedback [ 10000 ] | In Progress [ 3 ] |