Re: Newbie: Composition by Association - Pagination Class general question.
| From: | Stuart | Date: | Sun, 19 Jul 2009 13:44:15 +0000 |
| Subject: | Re: Newbie: Composition by Association - Pagination Class general question. | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295574@lists.php.net to get a copy of this message | ||
2009/7/19 MEM <talofo@gmail.com>:
>> I don't know how your other classes are arranged,
>
> myPDO.class.php -> Singleton. Makes the connection to the database possible.
>
> generalDAO.class.php -> Abstract DAO Class, grabs the myPDO instance and could have other
> methods on the future that are shared for all the DAO classes.
>
> AnimalsDAO.class.php -> DAO class with insertAnimal(); deleteAnimal(); updateAnimal();
> countAnimal(); selectSpecificAnimam() methods...
>
> The same goes for the VetDAO.class.php.
>
>
>> but personally I'd
>> build pagination into a class that provides raw data access, then
>> inherit that for specific types of data like animals. Efficient
>> pagination is too tightly coupled to the data source to be separate.
>
> According to the above, does this suggestion of yours still apply?
> If so, what is the buzzword that I should look at so that "inherit that for specific types
> of data like animals" could be possible? What/where should I look/search to accomplish your
> suggestion?
I would say your pagination logic belongs in myPDO.class.php. Where I
have this functionality it's as simple as two arguments to the method
that gets data, $page and $perpage. Setting both to false would
retrieve all rows.
-Stuart
--
http://stut.net/