fix(resource): конвертация modDocument → msProduct (#329)#331
Open
Ibochkarev wants to merge 1 commit into
Open
fix(resource): конвертация modDocument → msProduct (#329)#331Ibochkarev wants to merge 1 commit into
Ibochkarev wants to merge 1 commit into
Conversation
Product Update processor failed to load the resource when class_key was changed in settings because parent initialize() requires msProduct in DB. Extract EnsureTargetClassKeyTrait from Category/Update and reuse in Product/Update. Closes modx-pro#329.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
При смене типа ресурса с «Документ» на «Товар магазина» в настройках MODX возвращал
resource_err_nfs(«Ресурс с ID … не найден»), сохранение не проходило.Product/Updateне переопределялinitialize(): родительский процессор ищет объект строго поclass_key = msProduct, пока в БД ещёmodDocument. Для категорий этот обход уже был вCategory/Update.Добавлен общий trait
EnsureTargetClassKeyTrait: передparent::initialize()временно записывает целевойclass_keyчерезmodResource. Trait подключён вCategory/Update(рефакторинг без изменения поведения) иProduct/Update(fix #329).UpdateFromGridполучает fix черезparent::initialize().Тип изменений
Связанные Issues
Closes #329
Как это было протестировано?
Конфигурация тестирования:
php -lна изменённых файлах)Ручной сценарий (после деплоя):
resource_err_nfs,class_key = msProduct, строка вms3_product_dataСкриншоты (если применимо)
resource_err_nfsпри смене типаЧеклист
Дополнительные заметки
msProductDataпосле save по-прежнему черезProductService::handleConversion()в плагинеOnDocFormSaveCategory/Update), обычный save существующего msProduct