[Enhancement] Phalcon\Mvc\Model\Query\BuilderInterface Definition
Hi,
It would be nice to complete the BuilderInterface definition to match the intended method from Builder
The missing methods are:
distinct getDistinct andHaving since v3.2.0 orHaving since v3.2.0 betweenHaving since v3.2.0 notBetweenHaving since v3.2.0 inHaving since v3.2.0 notInHaving since v3.2.0 forUpdate offset getOffset
If someone is implementing BuilderInterface, this would break their compatibility; this would be for an incompatible version change.
This affects Phalcon v3.2.2 and before.
Regards, Federico.
Hi,
I would like to add a question about this:
In \Phalcon\Mvc\Model\Query\Builder->inWhere the method signature is:
public function inWhere(string! expr, array! values, string! operator = BuilderInterface::OPERATOR_AND) -> <Builder>
while in \Phalcon\Mvc\Model\Query\BuilderInteface->inWhere is:
public function inWhere(string! expr, array! values, string! operator = BuilderInterface::OPERATOR_AND) -> <BuilderInterface>;
The difference is the return type.
Which one is correct?
- The first
- The second (my choice)
- Both.
I believe that an class implementing an interface should preserve signature exactly like it's presented on the interface, regardless than in this case Builder is implementing BuilderInterface.
There is also the case where BuilderInterface->betweenWhere() differs from Builder->betweenWhere() -> <Builder> but specifying which type of object it returns.
Is there a default criteria for this or it's just decided by convenience case by case?
Regards, Federico.
Closing in favor of #13855. Will revisit if the community votes for it, or in later versions.
This has been addressed in v4