Log message #4264370

# At Username Text
# May 29th 2021, 22:04 etibor i appreciate soo much and would like to offer a lunch for tommorow
# May 29th 2021, 22:03 kevin.pfeifer and like to help people :)
# May 29th 2021, 22:03 kevin.pfeifer i just really really like cakephp
# May 29th 2021, 22:03 kevin.pfeifer no
# May 29th 2021, 22:03 kevin.pfeifer :,)
# May 29th 2021, 22:03 etibor do you have a Patreon?
# May 29th 2021, 22:03 etibor okey Kevin you already helped me a lot thank you, i am going to try i am sure it will help
# May 29th 2021, 22:02 kevin.pfeifer ``` $rules->add(function ($entity, $options) { // Return a boolean to indicate pass/failure if($entity->score > $entity->storage->max || $entity->score < $entity->storage->min){ return false; } return true; }, 'ruleName');```
# May 29th 2021, 22:02 kevin.pfeifer so you need something like that
# May 29th 2021, 22:01 kevin.pfeifer don’t need to load them
# May 29th 2021, 22:01 kevin.pfeifer has already the connected entities in there
# May 29th 2021, 22:01 kevin.pfeifer but your $entity
# May 29th 2021, 22:01 kevin.pfeifer basically the same procedure as before
# May 29th 2021, 22:00 kevin.pfeifer ``` public function buildRules( RulesChecker $rules ): RulesChecker { $rules->add(function ($entity, $options) { // Return a boolean to indicate pass/failure xdebug_break(); $tmp = ""; return true; }, 'ruleName'); return $rules; }```
# May 29th 2021, 22:00 kevin.pfeifer is a custom rule
# May 29th 2021, 22:00 kevin.pfeifer what you need
# May 29th 2021, 22:00 kevin.pfeifer not with anything different
# May 29th 2021, 22:00 kevin.pfeifer ```public function validationDefault( Validator $validator ): Validator {``` is only meant to validate the data directly associated with the current model
# May 29th 2021, 21:59 kevin.pfeifer forget what i said above
# May 29th 2021, 21:59 kevin.pfeifer yes
# May 29th 2021, 21:59 kevin.pfeifer ha ok
# May 29th 2021, 21:59 kevin.pfeifer i guess my solution above is a bit too hacky
# May 29th 2021, 21:56 kevin.pfeifer lets check the docs
# May 29th 2021, 21:55 kevin.pfeifer to check the connected entity
# May 29th 2021, 21:55 etibor yes min and max values can be change in the future
# May 29th 2021, 21:55 kevin.pfeifer i guess you would need to have the same logic on the other model as well
# May 29th 2021, 21:55 kevin.pfeifer but after e.g. 1 day these min and max values change and the connected entity is then wrong?
# May 29th 2021, 21:54 etibor if not with depending on the values of another entity
# May 29th 2021, 21:54 kevin.pfeifer I am just thinking that through What if your first “add” action works because your connected storage entity has valid min and max values
# May 29th 2021, 21:54 etibor but how would you deal with that?
# May 29th 2021, 21:53 etibor okey i found in my directory the Factory Locator
# May 29th 2021, 21:53 kevin.pfeifer depending on the values of another entitiy
# May 29th 2021, 21:53 kevin.pfeifer to have input validation present
# May 29th 2021, 21:53 kevin.pfeifer but I personally never had that case to be honest
# May 29th 2021, 21:52 kevin.pfeifer its present
# May 29th 2021, 21:52 kevin.pfeifer https://github.com/cakephp/cakephp/blob/3.x/src/Datasource/FactoryLocator.php
# May 29th 2021, 21:52 kevin.pfeifer ah wait
# May 29th 2021, 21:52 etibor i am looking for the using of FactoryLocator Class in Cake but at first sight its seem its for cake4
# May 29th 2021, 21:52 kevin.pfeifer but seems like that factory locator is also present in cake3 so it should work :) https://github.com/cakephp/cakephp/blob/master/src/Datasource/FactoryLocator.php
# May 29th 2021, 21:50 kevin.pfeifer and with that table object you can then (as like you where in the controller or in the model of that table) load entities and check their fields
# May 29th 2021, 21:49 kevin.pfeifer you can basically load any table from anywhere when you have a Table Locator Object