PHP OOP: Am i following right way?
- by sineverba
I'm learning OOP (PHP).
I've realized my own CRUD Class, that performs some kind of queries SQL.
Btw, a Gasoline asked us to realize a smart, simple web-app where he can update prices of his gasoline (gasoline, diesel, lpg) and via an API i could recall them and display in his site.
So, I did create a new Class Gasoline but it perform some methods of CRUD Class
public function getPrezzoBenzina($id) {
$prezzo_benzina = $this->distributore->sql('SELECT prezzo_benzina FROM prezzi WHERE id = '.$id);
return $prezzo_benzina
}
And so on (code is pseudocode, just to explain).
I could perform all my code only with help of Crud Class... without necessity of Class Gasoline. So, what I'm missing about OOP? Where am I wrong?