However, even if attachments are properly attached to my model, model.relation.beforeAdd and model.relation.afterAdd events are not called because $sessionKey is obviously null.
P.s.
From the docs, it reads that is_public property must explicitly set when using the add method. However this condition seems to ensure that the correct value is properly set.
Alternatively, you can prepare a File model before hand, then manually associate the relationship later. Notice the is_public attribute must be set explicitly using this approach.
Winter CMS Build
1.2
PHP Version
8.1
Database engine
MySQL/MariaDB
Plugins installed
No response
Issue description
Hi,
I was trying to debug it and, while reading the sources, I saw this and it doesn't feel right at first glance: https://github.com/wintercms/storm/blob/374add95da31e6ba1ab4b07ac6d4f03fa85c2503/src/Database/Relations/Concerns/AttachOneOrMany.php#L153-L155
In my controller, I have something like:
However, even if attachments are properly attached to my model,
model.relation.beforeAdd
andmodel.relation.afterAdd
events are not called because$sessionKey
is obviouslynull
.P.s. From the docs, it reads that
is_public
property must explicitly set when using theadd
method. However this condition seems to ensure that the correct value is properly set.Any suggestion? Thank you as always.
Steps to replicate
$attachMany
relation.create
method.Workaround
No response