RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question.
| From: | MEM | Date: | Sun, 19 Jul 2009 15:16:32 +0000 |
| Subject: | RE: [PHP] Re: Newbie: Composition by Association - Pagination Class general question. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-295584@lists.php.net to get a copy of this message | ||
> As for (1) even in my pre-OO days I was used to using a single generic
> DAO
> for all database access. The only time that more than one DAO existed
> was
> for a different DBMS engine. This is why I have one DAO class for MySQL,
> one
> for PostgreSQL and another for Oracle. If you are incapable of writing
> a
> single generic DAO then it just shows that you still have a lot to
> learn.
> For an idea on how this works take a look at
> http://www.tonymarston.net/php-mysql/databaseobjects.html
I'm absolutly sure that I have a lot to learn. Really a lot. :-)
I have post some days ago, a way for using a generic CRUD class and DAO, but
I get no replys so I wrongly suppose that my question was a nonsense
question, and that CRUD and DAO would be a nonsense.
> As for (2) it should be obvious that pagination is not an entity in its
> own
> right that has its own properties and methods, it is merely a function
> which
> can be performed on any entity within the system.
Ok...
> It should also be
> obvious
> that the requirements of pagination cannot be satisfied in a single
> class as
> some of the processing has to be handled in the presentation (UI) layer
> while the remainder is handled in the data access layer.
That's why I was thinking on using a Decorator Object on the Pagination
Class (that will retrieve DAO values to operate).
> The
> presentation
> layer needs a means to submit a request for a particular page number as
> well
> as the page size (rows per page). These two values are sent to the DAO
> which
> then translates them into values for LIMIT and OFFSET. After the DAO
> has
> issued the sql SELECT statement it needs to return two values - the
> current
> page number and the last available page number. The presentation layer
> then
> needs a mechanism to display these two values. This is explained in
> http://www.tonymarston.net/php-mysql/pagination.html
Thanks for explain the workflow! I will read.
>
> If you still don't see how this works then you can run my sample
> application
> at http://www.tonymarston.net/php-mysql/sample-application.html
> You can
> even
> download the code so that you can step through it with your debugger.
I haven't learn how to use a debugger yet. And I'm sure it would help me a
lot on understanding some data workflow...
Thanks,
Márcio