| 388 | | public function setFilter($fields) |
|---|
| 389 | | { |
|---|
| 390 | | throw new Exception('This method has not been implemented yet'); |
|---|
| | 388 | // TODO: remove Criteria dependancy |
|---|
| | 389 | public function addFilter($column, $value, $comparison = Criteria::EQUAL) |
|---|
| | 390 | { |
|---|
| | 391 | $this->requireColumn($column); |
|---|
| | 392 | |
|---|
| | 393 | $query = $this->query; |
|---|
| | 394 | |
|---|
| | 395 | // is you have a query object |
|---|
| | 396 | if ($this->query) |
|---|
| | 397 | { |
|---|
| | 398 | // check if an objectPath has been given |
|---|
| | 399 | $lastDot = strrpos($column, '.'); |
|---|
| | 400 | if ($lastDot !== false) |
|---|
| | 401 | { |
|---|
| | 402 | // get the objectPath |
|---|
| | 403 | $objectPath = substr($column, 0, $lastDot); |
|---|
| | 404 | |
|---|
| | 405 | // and get Related Query Class |
|---|
| | 406 | $strRelated = $query->translateObjectPathToAlias($objectPath); |
|---|
| | 407 | $query = $query->useQuery($strRelated); |
|---|
| | 408 | $column = substr($column, $lastDot + 1); |
|---|
| | 409 | } |
|---|
| | 410 | } |
|---|
| | 411 | |
|---|
| | 412 | $query->filterBy($column, $value, $comparison); |
|---|