Log message #4203398

# At Username Text
# Sep 16th 2019, 19:31 ricksaccous setters are for when you want to modify an existing property and spit that out
# Sep 16th 2019, 19:28 jotpe I know it was something with an Object/Enity, but can't remember. Anyone knows?
# Sep 16th 2019, 19:28 jotpe For some reason I got `Call to undefined method Users\Model\Entity\Emailaddress::status()`
# Sep 16th 2019, 19:27 slackebot <jotpe>
# Sep 16th 2019, 19:27 jotpe I've got a setter in my Entity for a field:
# Sep 16th 2019, 18:36 ricksaccous @maymeow i've never tried to do that but i found this https://github.com/naneau/php-obfuscator
# Sep 16th 2019, 18:30 maymeow i need advise. I have php application but i want protect some code from altering by users. Can be done something like this in php? (its problem because php apps is distributed as plain text not in compiled form)
# Sep 16th 2019, 18:08 henri.mjr I understand.. worked now, thanks
# Sep 16th 2019, 18:05 ricksaccous you can never do it the way you are attempting regardless since request data is immutable
# Sep 16th 2019, 17:59 henri.mjr argh.. token was not accessible!
# Sep 16th 2019, 17:56 henri.mjr uhmm
# Sep 16th 2019, 17:56 ricksaccous yes, $this->request/$this->getRequest() are immutable
# Sep 16th 2019, 17:55 admad @henri.mjr `$data = $this->request->getData()' unset($data['token'], $data['time_out']); $user = $this->Usuarios->patchEntity($user, $data);`
# Sep 16th 2019, 17:43 henri.mjr $user['token'] is filled :(
# Sep 16th 2019, 17:42 henri.mjr Hello! How it's the correct way to unset a field before patch? `$this->request->data['token'] = null;` ` $this->request->data['token_timeout'] = null;` ` $user = $this->Usuarios->patchEntity($user, $this->request->getData());`
# Sep 16th 2019, 17:36 jotpe Thanks for your help, @javier.villanueva
# Sep 16th 2019, 17:36 jotpe $confirmationsTable = TableRegistry::getTableLocator()->get('Users.EmailaddressConfirmations');
# Sep 16th 2019, 17:36 jotpe it's always the same. I run into the trap of not specifiying the plugin when getting the table...
# Sep 16th 2019, 17:35 jotpe DAMN.
# Sep 16th 2019, 17:20 javier.villanueva yes... if you dont want save two times, you can use a database trigger
# Sep 16th 2019, 17:20 jotpe Wait
# Sep 16th 2019, 17:20 jotpe So i have to set before
# Sep 16th 2019, 17:20 jotpe I guess that should break the foreign key constraint
# Sep 16th 2019, 17:20 javier.villanueva fuck return
# Sep 16th 2019, 17:19 javier.villanueva if ($confirmationTable->save($confirmation)) { $confirmation->emailaddress_id = $confirmation->id; }
# Sep 16th 2019, 17:18 javier.villanueva I dont know if is possible
# Sep 16th 2019, 17:17 javier.villanueva with a field or the same entity
# Sep 16th 2019, 17:17 javier.villanueva do you want to set this field always (auto)
# Sep 16th 2019, 17:17 javier.villanueva ok I understand now
# Sep 16th 2019, 17:16 jotpe 'emailaddress_id' => $entity->id
# Sep 16th 2019, 17:16 jotpe I set the entity_id when creating the newEntity
# Sep 16th 2019, 17:15 javier.villanueva it creates the protection entity with emailaddress_id to "null"?
# Sep 16th 2019, 17:15 jotpe yes
# Sep 16th 2019, 17:15 slackebot <jotpe>
# Sep 16th 2019, 17:15 javier.villanueva the new confirmation?
# Sep 16th 2019, 17:14 javier.villanueva and the entity is created?
# Sep 16th 2019, 17:14 jotpe I have
# Sep 16th 2019, 17:14 javier.villanueva because this is the solution
# Sep 16th 2019, 17:13 jotpe yes
# Sep 16th 2019, 17:13 javier.villanueva check if you has access to this field in Entity
# Sep 16th 2019, 17:07 jotpe Unfortunately setting the field in the constructor didn't worked