CakePHP 4 - Mutators not hit on Remote Server

Hey guys!

Unfortunately my mutators, especially “_setPassword”, wont work on my remote server. The thing is, it works fine on my local machine (docker image).

It is as simple as written in the “Auth” Tutorial here: https://book.cakephp.org/4/en/tutorials-and-examples/cms/authentication.html

I have an entity called “User” which has a field “password”. This field should always get encrypted while setting. Therefore I’ve created this mutator:

protected function _setPassword(string $password) {
    $hasher = new DefaultPasswordHasher();
    return $hasher->hash($password);
}

Unfortunately it won’t get encrypted on my remote server (ubuntu 18).

Does anyone have an idea whats going on there?

Kind regards,

In the code where you’re just about to save the entity, check the type of it and make sure it’s the class you expect it to be. People often develop on Windows servers, which have non-case-sensitive filesystems, so naming errors go unnoticed, and then when they deploy to a Linux system things break. If you’re getting a generic Cake entity object instead of your expected one, then it’s likely either your table or your entity implementation file is not named correctly. (You can check the type of the table object as well to narrow down, if this is the problem.)