# |
Jul 5th 2018, 14:41 |
camdenbassett |
Anyone have experience creating a custom validator which extends the normal validator? The custom validator seems to work, but I keep on getting the message "validationDefault(App\SIDev\Validation\GeneralValidator $validator) should be compatible with Cake\ORM\Table::validationDefault(Cake\Validation\Validator $validator)" |
# |
Jul 5th 2018, 14:37 |
camdenbassett |
hello everyone |
# |
Jul 5th 2018, 13:59 |
Diego_ |
$this->Auth->setConfig('loginRedirect', $this->referer()); |
# |
Jul 5th 2018, 13:56 |
Diego_ |
loginRedirect |
# |
Jul 5th 2018, 13:56 |
Diego_ |
$this->Auth->setConfig('autloginRedirecthError', 'link'); ? |
# |
Jul 5th 2018, 13:47 |
neon1024 |
As I’d kinda like to preserve the redirect url if they’re logged out due to inactivity |
# |
Jul 5th 2018, 13:46 |
neon1024 |
Or would I just forward users from the login method? |
# |
Jul 5th 2018, 13:46 |
neon1024 |
Can I set the Auth loginRedirect dynamically based on the user? |
# |
Jul 5th 2018, 12:06 |
neon1024 |
Thanks @josbeir and @admad for helping me rubber duck :duck: |
# |
Jul 5th 2018, 12:05 |
neon1024 |
Yep, that’s sorted it! |
# |
Jul 5th 2018, 12:04 |
josbeir |
^^ |
# |
Jul 5th 2018, 12:03 |
neon1024 |
@josbeir Yeah, you can :slightly_smiling_face: |
# |
Jul 5th 2018, 12:03 |
neon1024 |
Seems to be a method for it, just missed it! |
# |
Jul 5th 2018, 12:03 |
neon1024 |
https://book.cakephp.org/3.0/en/orm/behaviors.html#limiting-or-renaming-exposed-finder-methods |
# |
Jul 5th 2018, 12:02 |
josbeir |
just thinking out loud |
# |
Jul 5th 2018, 12:01 |
josbeir |
that way you can use both scenarios |
# |
Jul 5th 2018, 12:01 |
josbeir |
cant your create the methods you want AND a finder method that calls these methods internally ? |
# |
Jul 5th 2018, 12:01 |
neon1024 |
I would prefer to use a behaviour, so I will try that first |
# |
Jul 5th 2018, 12:00 |
josbeir |
trait it |
# |
Jul 5th 2018, 12:00 |
josbeir |
ah right |
# |
Jul 5th 2018, 12:00 |
neon1024 |
I can’t do that from a behaviour |
# |
Jul 5th 2018, 12:00 |
josbeir |
and overriding _dynamicFinder() ? |
# |
Jul 5th 2018, 12:00 |
neon1024 |
Next plan of attack! |
# |
Jul 5th 2018, 12:00 |
neon1024 |
So I should be able to map the methods in my behaviour, all to the same method |
# |
Jul 5th 2018, 11:59 |
neon1024 |
Yeah, using `__call` doesn’t work either. This is because the `callFinder()` method uses `method_exists` on the Table, and then uses the behaviours `hasFinder()` method, before throwing the exception. So the method is never actually called for the `__call` to catch |
# |
Jul 5th 2018, 11:58 |
slackebot4 |
Action: josbeir hides |
# |
Jul 5th 2018, 11:58 |
josbeir |
Diego_ I believe @admad has used this plugin x)x)x) |
# |
Jul 5th 2018, 11:57 |
josbeir |
you should read up on all router methods, they come in handy from time to time :slightly_smiling_face: |
# |
Jul 5th 2018, 11:57 |
josbeir |
Router::reverse($array) |
# |
Jul 5th 2018, 11:57 |
Diego_ |
Hello, im trying to use this plugin (https://github.com/ADmad/cakephp-jwt-auth) to authenticate my test api controller actionbut im having some issues with function authenticate() not being called, have anyone used this plugin? |
# |
Jul 5th 2018, 11:56 |
birdy247 |
then i can do an easy comparison |
# |
Jul 5th 2018, 11:56 |
birdy247 |
is there a way to pass in an array and see the matched route? |
# |
Jul 5th 2018, 11:56 |
birdy247 |
and tell me the matched route |
# |
Jul 5th 2018, 11:56 |
birdy247 |
so that works well |
# |
Jul 5th 2018, 11:56 |
birdy247 |
cool |
# |
Jul 5th 2018, 11:56 |
josbeir |
or $this->request->here etc... |
# |
Jul 5th 2018, 11:55 |
josbeir |
also @birdy247 => $this->getRequest()->getAttribute('here') can also be used to get the current url |
# |
Jul 5th 2018, 11:53 |
josbeir |
:point_up: |
# |
Jul 5th 2018, 11:53 |
admad |
@birdy247 router::parser() or reverseToArray() |
# |
Jul 5th 2018, 11:52 |
josbeir |
you need Router::parse() then |
# |
Jul 5th 2018, 11:52 |
josbeir |
oh my mistake |