# |
Sep 17th 2019, 13:07 |
ra7bi |
hello , im trying to understand this point https://book.cakephp.org/elasticsearch/2.x/en/#searching-indexed-documents but i couldn't get result from elasticsearch i created ```model/document/user.php``` then i put ``` namespace App\Model\Document; use Cake\ElasticSearch\Document; class User extends Document { } ```` |
# |
Sep 17th 2019, 12:51 |
henri.mjr |
It was what i'm looking for, valeu Felipão! |
# |
Sep 17th 2019, 12:50 |
henri.mjr |
I'll try |
# |
Sep 17th 2019, 12:40 |
felipe.marinho |
or even better: ```$usuario = $this->Acompanhantes->Usuarios->get($this->Auth->user('id'), ['contain' => ['grupos']]);``` |
# |
Sep 17th 2019, 12:37 |
felipe.marinho |
```$usuario = $this->Acompanhantes->Usuarios->get($this->Auth->user('id')); $grupo = $this->Acompanhantes->Usuarios->Grupos->get($usuario->grupo_id);``` |
# |
Sep 17th 2019, 12:35 |
felipe.marinho |
Why don't you "get" the group too? the same as the User.... |
# |
Sep 17th 2019, 12:33 |
henri.mjr |
The intention is get the Grupo.name of the user (grupo_id) when in AcompanhantesController (Usuarios belongs to Grupos, Acompanhantes belongs to Usuarios).. |
# |
Sep 17th 2019, 12:31 |
alexdd55976 |
at first look it seems fine thos |
# |
Sep 17th 2019, 12:30 |
henri.mjr |
Hello! This is working, but i feel i'm doing something wrong... `$usuario = $this->Acompanhantes->Usuarios->get($this->Auth->user('id'));` `$grupo = $this->Acompanhantes->Usuarios->Grupos->find('all',['conditions' => ['id'=>$usuario['grupo_id']]])->first();` |
# |
Sep 17th 2019, 11:14 |
jotpe |
thanks @conehead I ended up, with $user->setError() in the Controller |
# |
Sep 17th 2019, 11:09 |
conehead |
BeforeMarshal is used to convert form data to saveable entities. So this is not the right spot for you |
# |
Sep 17th 2019, 11:09 |
jotpe |
Yeah, it's not saving |
# |
Sep 17th 2019, 11:08 |
conehead |
If you are not saving it at all or it is not related to any Entity |
# |
Sep 17th 2019, 11:08 |
conehead |
For me it sounds more like you should validate it in your controller |
# |
Sep 17th 2019, 11:06 |
jotpe |
It's just in the request data |
# |
Sep 17th 2019, 11:06 |
jotpe |
Even if my Entity doesn't have the field set? |
# |
Sep 17th 2019, 11:06 |
alexdd55976 |
i think, you can validate at any point |
# |
Sep 17th 2019, 11:04 |
jotpe |
How can I validate a field, which is only present in the Form, but not in my Entity (e.g. comparing a `password` and a `password_repeat`? Or should I do this in beforeMarshal? |
# |
Sep 17th 2019, 10:49 |
challgren |
Ah ha it is `Cake\TestSuite\TestEmailTransport` wonder why this transport would be default when running in Integration Test mode |
# |
Sep 17th 2019, 10:47 |
jotpe |
;9 |
# |
Sep 17th 2019, 10:47 |
jotpe |
Got it `$this->Authentication->setIdentity($user);` |
# |
Sep 17th 2019, 10:44 |
jotpe |
Is there a way to set the Identity in the new Authentication plugin (e.g. After User Registration -> Log a user automatically in)? |
# |
Sep 17th 2019, 10:27 |
challgren |
Ok weird for some reason when running integration tests it seems like debug transport is loaded instead of the real transport |
# |
Sep 17th 2019, 10:25 |
challgren |
I think thats why]\ |
# |
Sep 17th 2019, 10:25 |
challgren |
https://github.com/cakephp/cakephp/compare/3.8.2...3.8.4#diff-bf0a8fe5a8b62d4ca6be6deb2d9a4b35R42 |
# |
Sep 17th 2019, 10:24 |
challgren |
Weird my tests are failing on 3.8.4 but work on 3.8.2 |
# |
Sep 17th 2019, 10:24 |
jotpe |
thy |
# |
Sep 17th 2019, 10:24 |
jotpe |
@neon1024 yeah right, was a bit confused because I have that combined validation |
# |
Sep 17th 2019, 10:23 |
neon1024 |
https://github.com/cakephp/cakephp/blame/c50454fef169771cb28cb7589c9ead026f0c77f3/src/Mailer/Mailer.php#L312 |
# |
Sep 17th 2019, 10:23 |
neon1024 |
@jadb Did 5 years ago |
# |
Sep 17th 2019, 10:22 |
challgren |
Grrr who changed the Mailer->send() return value! |
# |
Sep 17th 2019, 10:21 |
neon1024 |
@jotpe They should show up in the FormHelper output if the fields match up |
# |
Sep 17th 2019, 10:17 |
jotpe |
Is there some Helper or something to show Validation Errors? |
# |
Sep 17th 2019, 10:07 |
jotpe |
Thanks @javier.villanueva it worked :slightly_smiling_face: |
# |
Sep 17th 2019, 09:55 |
steinkel |
@neon1024 SecurityComponent |
# |
Sep 17th 2019, 09:48 |
jotpe |
I'll try |
# |
Sep 17th 2019, 09:48 |
jotpe |
ah okay |
# |
Sep 17th 2019, 09:48 |
jotpe |
yeah i thought it's the right place |
# |
Sep 17th 2019, 09:48 |
javier.villanueva |
$rules->add($rules->isUnique(['first_name', 'last_name'])); |
# |
Sep 17th 2019, 09:48 |
javier.villanueva |
in buildRules you can try |
# |
Sep 17th 2019, 09:48 |
javier.villanueva |
ahm |