# |
Jul 10th 2017, 10:47 |
inoas |
https://gist.github.com/ionas/94e961bf414c78362442041081dad3ca#file-option-arrays-php-L4 |
# |
Jul 10th 2017, 10:47 |
inoas |
vs this very concise interface |
# |
Jul 10th 2017, 10:47 |
inoas |
did you see the setter example here https://github.com/cakephp/cakephp/issues/10866#issuecomment-313391901 |
# |
Jul 10th 2017, 10:46 |
inoas |
that class can exist I am okay with that |
# |
Jul 10th 2017, 10:46 |
inoas |
I am not talking about the routing class |
# |
Jul 10th 2017, 10:45 |
hmic |
me too. but it's up to your (custom!) business logic to implement these. not the routing classes |
# |
Jul 10th 2017, 10:45 |
inoas |
but I fear the setter/getter-hell will be a very bad pattern here |
# |
Jul 10th 2017, 10:45 |
inoas |
I totally see the reason to be strict/er on options |
# |
Jul 10th 2017, 10:45 |
inoas |
it is error prone to miss-type options and it is error prone once interfaces change to forget about removing some etc |
# |
Jul 10th 2017, 10:44 |
hmic |
why is this? - because the set of options changes. who would need to validate the possible ones? the underlying routing class? - not really. |
# |
Jul 10th 2017, 10:42 |
inoas |
lorenzo around? |
# |
Jul 10th 2017, 10:41 |
inoas |
thats what we do already but not standardized but always different each time there are options to consume |
# |
Jul 10th 2017, 10:41 |
inoas |
building a pattern validator for the options and validating it against that before consuming the options |
# |
Jul 10th 2017, 10:41 |
inoas |
I can see the reason why to add it but there is a different way... namely doing something like pattern matching one could say |
# |
Jul 10th 2017, 10:40 |
inoas |
but what is far worse is the interface which is ultra verbose |
# |
Jul 10th 2017, 10:40 |
inoas |
what I fear is that the code required to do options validation will be very verbose and lack interactions such as nested validation, optionality and default values |
# |
Jul 10th 2017, 10:40 |
inoas |
I can't follow entirely |
# |
Jul 10th 2017, 10:39 |
hmic |
inoas, the idea to go with arrays is pretty clear, and i don't think it will change in the nead future, especially for routing/url generation. despite the fact that/if you would want your urlObjects frozen? how do you make your prefix optional? or add another query param? - pass this through like 3 layers of code down to where you need to build the urlObject |
# |
Jul 10th 2017, 10:38 |
inoas |
hmic around? |
# |
Jul 10th 2017, 10:37 |
Sebollson |
silly me |
# |
Jul 10th 2017, 10:37 |
Sebollson |
;) |
# |
Jul 10th 2017, 10:37 |
Sebollson |
so not cake related |
# |
Jul 10th 2017, 10:37 |
Sebollson |
insteed of AGAINST('+term1 +term2' IN BOOLEAN MODE) |
# |
Jul 10th 2017, 10:37 |
Sebollson |
for some reasons i thougt it should be MATCH .. AGAINST ('+term1', '+term2' IN BOOLEAN MODE) |
# |
Jul 10th 2017, 10:36 |
inoas |
ok - probably works now then ;) |
# |
Jul 10th 2017, 10:36 |
Sebollson |
i did that alread - its just for some reasons i wanted to pass multipe arguments insteed of 1 into AGAINST clause |
# |
Jul 10th 2017, 10:36 |
inoas |
before injecting it into the query builder |
# |
Jul 10th 2017, 10:35 |
inoas |
then concat to build the string to match against |
# |
Jul 10th 2017, 10:35 |
Sebollson |
in boolean mode, thats the syntax |
# |
Jul 10th 2017, 10:35 |
inoas |
matching against +term1 +term2? |
# |
Jul 10th 2017, 10:34 |
Sebollson |
g2k |
# |
Jul 10th 2017, 10:34 |
inoas |
yes. |
# |
Jul 10th 2017, 10:34 |
Sebollson |
ooo |
# |
Jul 10th 2017, 10:34 |
Sebollson |
o |
# |
Jul 10th 2017, 10:34 |
inoas |
it will be deprecated and removed in future. |
# |
Jul 10th 2017, 10:34 |
inoas |
Sebollson: are you sure it is required ;)? |
# |
Jul 10th 2017, 10:34 |
Sebollson |
thanks for help :) |
# |
Jul 10th 2017, 10:34 |
Sebollson |
nevertheless, normally i dont use orWhere, but it is required in this case ;) |
# |
Jul 10th 2017, 10:34 |
Sebollson |
but matching against term1 OR matching against term2 is not the same as matching against +term1 +terma2 |
# |
Jul 10th 2017, 10:32 |
inoas |
admad is this so far off the charts? because I still see Url Objects being pushed as a PR and I feel that it is related https://github.com/cakephp/cakephp/issues/10866#issuecomment-313391901 |
# |
Jul 10th 2017, 10:29 |
inoas |
and I would recommend using where(['OR' => [list of conditions]]) then |