RuleBritannia Posted January 16, 2014 Share Posted January 16, 2014 What would you say is best practice? Thanks in advance for any answers/advice. Quote Link to comment https://forums.phpfreaks.com/topic/285415-get-row-within-class-or-pass-row-to-class/ Share on other sites More sharing options...
Ch0cu3r Posted January 16, 2014 Share Posted January 16, 2014 What is it you are trying to do? What row? What class? Quote Link to comment https://forums.phpfreaks.com/topic/285415-get-row-within-class-or-pass-row-to-class/#findComment-1465419 Share on other sites More sharing options...
RuleBritannia Posted January 16, 2014 Author Share Posted January 16, 2014 What is it you are trying to do? What row? What class? I think I have found some principles to abide by to reach a ultimate solution. data mappers or active record, But I think data mappers are best in my case as I want to stay within SRP. I am trying to store a row from a table, So I can return values when needed, whilst also updating these field(s) when needed, However a new problem occured, Which is when I perform a update and change a value, the row stored in the object will now not reflect the updated field in the database, so a requery would be needed, But I believe active record and data mappers cover this. Quote Link to comment https://forums.phpfreaks.com/topic/285415-get-row-within-class-or-pass-row-to-class/#findComment-1465429 Share on other sites More sharing options...
ignace Posted January 17, 2014 Share Posted January 17, 2014 Use the Data Mapper to write your changes back to the database but only if you have a complex object graph. Use a Repository otherwise. Quote Link to comment https://forums.phpfreaks.com/topic/285415-get-row-within-class-or-pass-row-to-class/#findComment-1465545 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.