setters on business objects should not have database side effects

XMLWordPrintable

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • 1.4.0
    • Affects Version/s: 1.3.0
    • Component/s: API
    • None

      calling some setters (e.g. group.setExtension()) will store the data to the database inside the setter.

      This is not ideal because:

      1. It is generally not expected that setters store data
      2. It could be more efficient to have one store method, e.g.

      group.setAttribute("something", "whatever");
      group.setExtension("ext");
      group.setDisplayExtension("disp ext");
      group.store();

      3. For hooks, the hooks would fire with each setter, instead of potentially one hook for all the activity
      4. Although there are still methods that cause database side effects, generally it is better to explicitly kick that off with the DB api or a store() method
      5. Multiple calls to setters should occur in one transaction

            Assignee:
            Chris Hyzer (upenn.edu)
            Reporter:
            Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: