Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-331

Partially move kCatDBItem and CreategoryItem class contents to OnBefore/OnAfter events

    XMLWordPrintable

    Details

    • Type: Bug Report
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.1
    • Fix Version/s: 5.2.0-B1
    • Component/s: Optimization
    • Labels:
      None

      Description

      Classes kCatDBItem and CreategoryItem were created before OnBefore/OnAfter events were invented. That's why most of their code is not located in them, as it should. When OnBefore/OnAfter events are used with that classes, then it in most cases lead to unpredictable behavior and hardly detectable processing logic errors.

      For example you expect, that OnAfterItemCreate is called after category item is created. But it happens in the middle and after it's called category item is assigned to primary category. Created category item (in state available in OnAfterItemCreate event) won't be able to load at all, because it JOINed to CategoryItems table, where record is not present at the moment.

      How this happens now:
      1. kCatDBItem::Create()
      2. kCatDBEventHandler::OnAfterItemCreate(&$event)
      3. kCatDBItem::assignPrimaryCategory()
      4. kCatDBItem::Update()
      5. kCatDBEventHandler::OnAfterItemUpdate(&$event)

      How this should happen:
      1. kCatDBItem::Create()
      2. kCatDBItem::assignPrimaryCategory()
      3. kCatDBItem::Update()
      4. kCatDBEventHandler::OnAfterItemUpdate(&$event)
      6. kCatDBEventHandler::OnAfterItemCreate(&$event)

      Because what's the point of OnAfter event if it's called in the middle and not at the end. Because of that there is no way to control what code (customized or original) will go first.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: