SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Denmark
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    When and how to do the actual saving

    I've created the following classes:

    http://svn.intraface.dk/intrafacepub...ty/Accounting/

    And the usage is shown here:

    http://svn.intraface.dk/intrafacepub...nting/Test.php

    Two questions?

    1) Now the question is, I need to save the data somehow (for instance in a database), but the question is where to do it in a design like this?

    2) How can I extend it so it is possible to make a threelegged transaction also?

  2. #2
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps the transaction should know how to save itself - and roll back if it can't. I don't know much about accounting though: what exactly do you need to keep records of?

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2003
    Location
    Denmark
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, it is a real double entry accounting system, which also needs to support threelegged transactions. But I am not sure how to design this - whether the transaction should be two or threelegged would be determined from the account type (whether it is an account where Tax are added or not - or for some accounts you also have to add a calculated amount and put it on another account).

    And I need to save the stuff in the database. However, Kyberfabrikken kind of showed me how he would do that, and I updated my code accordingly. I havent added rollback, because I never really understood how that will work in a reallife appl. What would it look like exactly.

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2004
    Posts
    428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    command pattern - undo + transactions



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •