Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0.x] [NFR] \Mvc\Model\Criteria - fromImput #10749 #10751

Merged
merged 1 commit into from
Aug 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed Session\Bag::remove()
- Session\Bag::destroy() eliminates any temporary data in the variables bag
- afterCreate/afterUpdate are only called if saving related records was successful
- Added parameter the changing concatenation conditions in method `Mvc\Model\Criteria::fromImput()` [#10749](https://github.com/phalcon/cphalcon/issues/10749)

# [2.0.6](https://github.com/phalcon/cphalcon/releases/tag/phalcon-v2.0.6) (2015-07-21)
- Builds in TravisCI now uses Docker to perform faster builds
Expand Down
4 changes: 2 additions & 2 deletions phalcon/mvc/model/criteria.zep
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ class Criteria implements CriteriaInterface, InjectionAwareInterface
/**
* Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST
*/
public static function fromInput(<DiInterface> dependencyInjector, string! modelName, array! data) -> <Criteria>
public static function fromInput(<DiInterface> dependencyInjector, string! modelName, array! data, string! operator = "AND") -> <Criteria>
{
var attribute, conditions, field, value, type, metaData,
model, dataTypes, bind, criteria, columnMap;
Expand Down Expand Up @@ -736,7 +736,7 @@ class Criteria implements CriteriaInterface, InjectionAwareInterface
*/
let criteria = new self();
if count(conditions) {
criteria->where(join(" AND ", conditions));
criteria->where(join(" " . operator . " ", conditions));
criteria->bind(bind);
}

Expand Down
2 changes: 1 addition & 1 deletion phalcon/mvc/model/criteriainterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ interface CriteriaInterface
/**
* Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST
*/
public static function fromInput(<DiInterface> dependencyInjector, string! modelName, array! data) -> <CriteriaInterface>;
public static function fromInput(<DiInterface> dependencyInjector, string! modelName, array! data, string! operator = "AND") -> <CriteriaInterface>;

/**
* Executes a find using the parameters built with the criteria
Expand Down