Hi there! I use validation in my custom Hooks and it works good, but I can't see changes with my relation Many-to-Many. I have alredy read about methods afterRelate and beforeRelate. Method beforeRelate doesn't work in my Hook =( Method afterRelate gave me 500 error (second argument must be string, array given) but I just only write function like beforeSave and don't pass any arrays.
My code in Hooks:
What I should to do for beforeRelate or afterRelate methods?
My code in Hooks:
PHP Code:
public function afterRelate(Entity $entity, string $relationName, Entity $foreignEntity, array $options = [])
{
$this->throwException('test', 'test');
}
private function throwException($label, $log)
{
$body = Body::create()
->withMessageTranslation($label, null)
->encode();
throw Error::createWithBody($log, $body);
}
Comment