Phalcon\Mvc\Query\Builder's constructor sample code in comment + support... #1205
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
I added support for defining 'offset' via constructor but there's many more to updated:
limit key could take array of 2 values (limit, offset) as the limit() method does limit (int $limit, [int $offset])
'conditions' key could take:
array(
array(string $conditions, [array $bindParams], [array $bindTypes])
)
or at least:
array(string $conditions, [array $bindParams], [array $bindTypes])
'having' key could work in the same way as 'conditions' but it could be simplified to single array(string $conditions, [array $bindParams], [array $bindTypes])
adding explicit DESC or ASC to 'order' value like that array('name DESC', 'id ASC') causes following exception thrown:
Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'Scanning error before 'name DESC], [id ...'
'models' key(added by me) could take also alias to be the same as addFrom (string $model, [string $alias])
lack of support for following: join, innejJoin, leftJoin, rightJoin, orWhere, betweenWhere, notBetweenWhere, inWhere, notInWhere.
PS. Why all those function aren't simply using methods of that class instead of setting them inside constructor?
PS. PS. On master branch there's still this 'having' typo which makes usage of 'having' key impossible.
I hope that all above makes sense and it' at least a little bit helpful.
Thanks,
Kamil