View Single Post
Old 09-14-2012, 08:49 PM   PM User | #5
Oatley
New Coder

 
Join Date: Sep 2012
Posts: 70
Thanks: 56
Thanked 0 Times in 0 Posts
Oatley is an unknown quantity at this point
Thanks again, that's great and really helped me understand it all much better. Just have a couple of last things to check to make sure I've understood it ok

Quote:
So if your individual class is capable of providing alternate storage instructions, I'd allow it to do so by creating it within. If it cannot provide alternate instructions, then I'd pass it as a parameter.
When you talk about alternate storage instructions do you mean alternate database connections throughout my site?

So if I used a PDO connection only throughout the site then I would pass it in as a parameter, but if I wanted to maybe pass the connection in maybe as EITHER a PDO connection or Mysqli connection for example I'd create the connection from within the class? Or have I not understanding it properly here?

Also one last question as well. Any child classes that extend a class that it's parent already has a connection I take it there is no need to create another connection in the child class?

Thank you again.
Oatley is offline   Reply With Quote