# |
Jun 28th 2017, 15:34 |
jarard |
i guess it's a matter of taste, more to the point though I'm not clear why the redirect for login goes to admin/users/login when in my app controller it is set to users/login |
# |
Jun 28th 2017, 15:33 |
jarard |
becuase it gives access to admin |
# |
Jun 28th 2017, 15:33 |
neon1024 |
It’ll really depend on where you controller is |
# |
Jun 28th 2017, 15:33 |
hmic |
why not? |
# |
Jun 28th 2017, 15:33 |
neon1024 |
Well you could visit /users/login just fine |
# |
Jun 28th 2017, 15:33 |
jarard |
I don't think it should be |
# |
Jun 28th 2017, 15:33 |
hmic |
jarard, what you think jarad? :O |
# |
Jun 28th 2017, 15:32 |
jarard |
when using admin prefix is it correct for the login to be in Admin/Users/ |
# |
Jun 28th 2017, 15:22 |
elboletaire |
yeah, orange is the new black :see_no_evil: |
# |
Jun 28th 2017, 15:04 |
chris-andre |
oh. notBlank() is the new notEmpty() :slightly_smiling_face: Good to know |
# |
Jun 28th 2017, 15:03 |
jeremyharris |
no worries, good luck :slightly_smiling_face: |
# |
Jun 28th 2017, 15:03 |
chris-andre |
Thanks anyway @jeremyharris . |
# |
Jun 28th 2017, 15:01 |
chris-andre |
That did not work. I need to do some other magic :P |
# |
Jun 28th 2017, 14:57 |
chris-andre |
That is just a quick test away from the answer. Ill test. |
# |
Jun 28th 2017, 14:56 |
chris-andre |
Allright, so if requirePresence fails, but the next rule is true, the property will go trough the validation? |
# |
Jun 28th 2017, 14:53 |
jeremyharris |
at least one of them must be posted though |
# |
Jun 28th 2017, 14:52 |
jeremyharris |
use requirePresence if you want it to fail if no property is posted. then if it is, it will continue down the list of rules for that key |
# |
Jun 28th 2017, 14:51 |
jeremyharris |
that is true |
# |
Jun 28th 2017, 14:51 |
chris-andre |
Yes. But it seems like the rule is not triggered if the property isn't posted. |
# |
Jun 28th 2017, 14:49 |
jeremyharris |
you’re on the right track then I think |
# |
Jun 28th 2017, 14:49 |
jeremyharris |
ah |
# |
Jun 28th 2017, 14:49 |
jeremyharris |
as an example |
# |
Jun 28th 2017, 14:49 |
chris-andre |
thats what I tried with my onOrTheOther() method. |
# |
Jun 28th 2017, 14:49 |
jeremyharris |
see: https://api.cakephp.org/3.4/source-class-Cake.Validation.Validation.html#306-323 |
# |
Jun 28th 2017, 14:48 |
jeremyharris |
you can probably make a single rule that accepts an argument for the fields to check :+1: |
# |
Jun 28th 2017, 14:48 |
chris-andre |
Yes, it is. Either a name has to be posted, or an organization number. Allright. Ill try figure it out. |
# |
Jun 28th 2017, 14:47 |
jeremyharris |
$this->request->getParam(‘prefix’) === ‘admin’ |
# |
Jun 28th 2017, 14:47 |
jarard |
what is the easiest way to check for admin prefix? |
# |
Jun 28th 2017, 14:47 |
jeremyharris |
if it’s an either-or situation |
# |
Jun 28th 2017, 14:46 |
jeremyharris |
you’ll need a rule that checks it in name as well |
# |
Jun 28th 2017, 14:46 |
jeremyharris |
you can check the “context” in that case |
# |
Jun 28th 2017, 14:46 |
chris-andre |
But damn. I will allow it empty, but either name or organization_number has to be filled. |
# |
Jun 28th 2017, 14:45 |
jeremyharris |
requirePresence would make it fail with no key defined |
# |
Jun 28th 2017, 14:45 |
jeremyharris |
bingo |
# |
Jun 28th 2017, 14:45 |
chris-andre |
Ah... There is nothing to validate! |
# |
Jun 28th 2017, 14:44 |
chris-andre |
Right. Here it is: https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-result-txt |
# |
Jun 28th 2017, 14:43 |
jeremyharris |
yeah heheh |
# |
Jun 28th 2017, 14:43 |
jeremyharris |
sorry, I meant the actual result entity |
# |
Jun 28th 2017, 14:43 |
chris-andre |
Or do you mean the object? :P |
# |
Jun 28th 2017, 14:43 |
chris-andre |
Here is entity https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-customer-php |
# |
Jun 28th 2017, 14:43 |
chris-andre |
In formhelper I use `'validate' => 'new'`, in action I use `'validator' => 'new'` |