Closed rabauss closed 1 year ago
Okay the problem is that the $request
object is not set while running contao:migrate
so the hook sqlGetFromFile
is not executed:
https://github.com/codefog/contao-haste/blob/dc3cea999909e2b81fd03f13c0da27ed1fc19536/src/DcaRelationsManager.php#L359
How do we solve this correctly?
that looks very weird, why would relations be tied to the request? 🤔
Well, this was migrated from this logic: https://github.com/codefog/contao-haste/blob/f5de7fd1b13fa9afce41dc466860918dc40eb13b/config/config.php#L39
I'm not sure if the hook sqlGetFromFile
even needs this restriction on backend
Yeah, this needs to be changed to:
if (null === $request || !$this->scopeMatcher->isFrontendRequest($request)) {
The intention was (likely) to only execute it in the back end and on the CLI (or conversely: execute it anywhere but the front end).
Ok, I'll add a PR
I think we should not check for request at all. This was legacy stuff in Contao 3.
In a project we have defined some custom entities with many-to-many relations like this:
After upgrading to Haste v5 the command
contao:migrate
deletes all relation tables (e.g.DROP TABLE tl_content_teaser_taxonomy
). In the contao install tool the deletions are not listed/executed only via console command! Our app bundle is loaded afterCodefogHasteBundle
!What's the reason for this misbehavior? Is there a framework init missing?