PHP OOP: Am i following right way?
Posted
by
sineverba
on Programmers
See other posts from Programmers
or by sineverba
Published on 2013-10-24T06:55:30Z
Indexed on
2013/10/24
10:10 UTC
Read the original article
Hit count: 251
php
|object-oriented
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?
© Programmers or respective owner