[Core] Session DAO

Review Request #37 — Created Jan. 8, 2013 and submitted

Felipe
Lunr
https://github.com/madsmash/lunr/tree/newSessionHandler
lunr
Session DatabaseAccessObject implementation 

Depends on http://reviews.lunr.nl/r/21/
Unit Tests
  • 0
  • 0
  • 16
  • 1
  • 17
Description From Last Updated
Felipe
pprkut
  1. 
      
  2. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    It's not a Model
  3. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
     
     
     
     
     
     
    I would visually separate the query building, just to make it easier readable
  4. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    superfluous
  5. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    put at the end
  6. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    superfluous
  7. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
     
    reverse the if. Makes it more readable
  8. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
     
    you may want to store it in a different variable
    1. Not really, I have finished using the previous builder. What's the benefit of putting it on a new variable?
    2. If you need something from the previous builder for debugging, it's no longer reachable. Note that since this is also the only DAO we have in Lunr right now, it's an example case.
      People will pick the code from here and do it similarly in other implementations and even though in this case it might be obvious you don't need the previous builder, it might not be in others.
  9. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
     
     
    needs to be escaped
  10. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    Isn't that done explicitely by end_transaction?
    1. End transaction sets autocommit to true. According to the comments in php doc site, setting autocommit to true will commit all pending transactions but I couldn't find any official document where it states so.
  11. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
     
    early exit
    1. reverted if to make it more readable as stated before. 
  12. src/Lunr/Core/SessionDAO.php (Diff revision 2)
     
     
    time() is an int, not a string
  13. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 2)
     
     
    what in here requires 5.4?
    1. Lunr 0.2?
      
      I don't know by heart the differences between 5.3 and 5.4, nor I have time to check it for every file I write.. Hence why I use 5.4 on all files. If you want to have 5.3 on files that don't need 5.4 then you will have to spot it on all reviews and nag, or fix it yourself when you do a general style fix or something similar.
    2. As a PHP developer you should know what features are new in the current release. Thus, if you note it needs 5.4, I will ask what does require it. Happy researching!
    3. I was about to change all array definitions... but it's easier to put down the php version :P
  14. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 2)
     
     
     
     
     
     
    move below setUp
  15. 
      
Felipe
Felipe
Felipe
pprkut
  1. 
      
    1. Doesn't belong to this review, dunno how it got here
  2. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 4)
     
     
     
     
    No longer exists
    1. Replaced with FileLogger
    2. Still wrong. You need to use the Interface, since at runtime I could also use the NullLogger or the PHPLogger
    3. Changed!
  3. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 4)
     
     
     
     
     
     
     
     
     
     
    I vaguely remember mentioning something about valueMap. Was that about this or another review?
    1. yep, it's in this one, it's in a function below, fixed here too.
  4. 
      
Felipe
Felipe
pprkut
  1. 
      
  2. src/Lunr/Core/SessionDAO.php (Diff revision 6)
     
     
    you can drop the pool here.
    The DatabaseAccessObject needs to support db connection pooling for DAOs that want to/need to access a database over more than one connection or multiple databases at once.
    Neither is the case for the SessionDAO, it will always be only one connection, accessing the same database.
  3. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 6)
     
     
    wrong type
  4. src/Lunr/Core/Tests/SessionDAOTest.php (Diff revision 6)
     
     
     
     
     
     
     
     
     
     
    Hmm, while this is technically correct I miss a bit of uniformity here. The DAO is not meant to be used with anything but MySQL, that comes with the dml query builder interface. However, then you can just as well Mock the mysql connection/query result instead of the generic db one.
  5. 
      
Felipe
Felipe
Review request changed

Status: Closed (submitted)

Change Summary:

Merged into master
Loading...