Closed neznaika0 closed 2 years ago
Maybe return solution? And ohter drivers
if (is_subclass_of($className, Entity::class)) {
return empty($data = $this->fetchAssoc()) ? false : (new $className())->fill($data)->syncOriginal();
}
If you completely remove the check on the Entity (and the private class), then fetch_object () does not call setters, it will immediately assign values to private properties. Therefore, the situation needs to be corrected.
If I do fill() then everything works fine - private properties are set and $attributes are filled in my setters
@neznaika0 We use GitHub issues to track BUGS and to track approved DEVELOPMENT work packages. We use our forum to provide SUPPORT and to discuss FEATURE REQUESTS.
What is it?
It's probably more of a mistake. I posted on the forum
I extended the Entity class by adding private properties. abandoned the magic of setters/getters - created get set Now setAttributes cannot call set* So fill() is the better solution. Regarding the password hash - this operation is done in the beforeInsert Model or by setting the hash yourself
Originally posted by @neznaika0 in https://github.com/codeigniter4/CodeIgniter4/issues/2011#issuecomment-1274160221