I've been looking more into how best to use OOP in relation to PHP as I don't think I'm making the best use of it currently and no matter how many sites I read it isn't really helping me improve my coding in any practical way. I thought if I gave an example of part of a project I'm working on and how I've done it someone might be able to give me some ideas on other methods of doing it and what the advantages would be.
I've put the code up on JSfiddle as I don't know of a better place to put it and adding it to this post would make it very long, the code itself won't run as I've taken out a lot of the 'inner workings' and replaced them with comments as I don't think seeing exactly how each method is implemented is directly related to this question. Also if I left it in there'd be a lot more code for people to go through.
Part of what I'm building is a CMS and the example I'm giving here is of the events part of the CMS which retrieves events, updates events & changes their status (live & not live).
I've structured it so there is a database_get method & a database_put method which gets results from and puts values into the database, these are the only two methods which scripts initialising this class use to interact with. They have a parameter to identify what needs to actually be done, for example in database_put they can create a new event, update and existing event, take an event offline, take an event offline & delete an event. Is this good practise restricting all interaction with the class to just two methods and having a variable passed it defining what needs to be done?
Getting events from the database is all in one method too, so if I was trying to retrieve all the events from a database or just the one it'd be handled by the one method and depending on if an ID is passed to it works out if it needs to retrieve them all or just a specific event. Is this a good idea or should I separate them out into more than one method? Or is there an even better method?
Also if anyone knows of any good reading material on the subject, online or books, I'd be glad to hear about them as I'd certainly like to be a lot better with my OOP.
Thanks all for any advice / tips in advance,