Log message #4264388

# At Username Text
# May 29th 2021, 22:24 etibor i tried to debug the entity: $rules->add(function ($entity, $options) {debug($entity);die;
# May 29th 2021, 22:24 kevin.pfeifer so like `$this->Documents->get($id)->contain('Storage')`
# May 29th 2021, 22:23 kevin.pfeifer when you do the save function on the entity it needs to already contain the connected data
# May 29th 2021, 22:22 kevin.pfeifer where i have my ->contain() in the query
# May 29th 2021, 22:22 etibor in an edit
# May 29th 2021, 22:22 kevin.pfeifer i just checked in the edit form before
# May 29th 2021, 22:21 kevin.pfeifer are you in an add form or in the edit form?
# May 29th 2021, 22:21 etibor are you sure "has already the connected entities in there" ?
# May 29th 2021, 22:21 kevin.pfeifer hmm
# May 29th 2021, 22:21 etibor i got this error Trying to get property 'max' of non-object
# May 29th 2021, 22:14 etibor if this will work you save me from a lot of stress
# May 29th 2021, 22:14 etibor i am going to implement
# May 29th 2021, 22:14 etibor :)
# May 29th 2021, 22:13 kevin.pfeifer otherwise you know where to find me ;P
# May 29th 2021, 22:12 kevin.pfeifer i hope with that rule your problem is solved
# May 29th 2021, 22:12 kevin.pfeifer dude wow, thank you ,:)
# May 29th 2021, 22:10 etibor Thank you Kevin really much your help, just think to your cake friend while having the coffe
# May 29th 2021, 22:06 kevin.pfeifer well I have a “Buy me a Coffee” Button on https://www.devguide.at/en/kategorie/backend/php/ if you really really really want to give me something But again, you don’t need to do that!
# 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