Mass delete templates in container version#522
Mass delete templates in container version#522ulcuber wants to merge 2 commits intomatomo-org:4.x-devfrom
Conversation
| * @param int $idContainerVersion | ||
| * @param string $deletedDate | ||
| */ | ||
| public function deleteContainerTags($idSite, $idContainerVersion, $deletedDate) |
There was a problem hiding this comment.
@ulcuber You aiming to update Import.php too with this PR right ?
Can you add those changes too ?
There was a problem hiding this comment.
I have tried to split it into small atomic independent issues. I'll optimize import next week
There was a problem hiding this comment.
@ulcuber Its better to include all such changes in 1 PR so that we can test and ensure that new changes do not lead to any regressions, I would suggest to add the Importer changes in same PR too or folk a branch from this and add those changes if you want to keep your changes separately
AltamashShaikh
left a comment
There was a problem hiding this comment.
Added comment for complete changes
|
@AltamashShaikh added optimization in import. |
| $this->variables->deleteContainerVariable($idSite, $idContainerVersion, $variable['idvariable']); | ||
| } | ||
| $now = Date::now()->getDatetime(); | ||
| $this->tagsDao->deleteContainerTags($idSite, $idContainerVersion, $now); |
There was a problem hiding this comment.
@ulcuber Can you create a deleteContainerTags() in Model/Tag.php and call the Model instead of dao
| } | ||
| $now = Date::now()->getDatetime(); | ||
| $this->tagsDao->deleteContainerTags($idSite, $idContainerVersion, $now); | ||
| $this->triggersDao->deleteContainerTriggers($idSite, $idContainerVersion, $now); |
There was a problem hiding this comment.
Same here call deleteContainerTriggers() in Model/Trigger.php and call the Model instead of dao
| $now = Date::now()->getDatetime(); | ||
| $this->tagsDao->deleteContainerTags($idSite, $idContainerVersion, $now); | ||
| $this->triggersDao->deleteContainerTriggers($idSite, $idContainerVersion, $now); | ||
| $this->variablesDao->deleteContainerVariables($idSite, $idContainerVersion, $now); |
There was a problem hiding this comment.
Same here Same here call deleteContainerVariables() in Model/Variable.php and call the Model instead of dao
| { | ||
| $this->checkImportContainerIsPossible($exportedContainerVersion, $idSite, $idContainer); | ||
|
|
||
| foreach ($this->tags->getContainerTags($idSite, $idContainerVersion) as $tag) { |
There was a problem hiding this comment.
@tsteur any specific reason we deleted 1 tag within a container at a time instead of deleting all at once like in this PR ?
AltamashShaikh
left a comment
There was a problem hiding this comment.
@ulcuber left few comments

Description:
Allows to resolve n+1 queries when deleting all templates in version
Review