Re: DB_DataObject and Structures_DataGrid integration
| From: | Justin Patrin | Date: | Fri, 13 Aug 2004 18:19:03 +0000 |
| Subject: | Re: DB_DataObject and Structures_DataGrid integration | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32644@lists.php.net to get a copy of this message | ||
On Fri, 13 Aug 2004 19:47:14 +0200, Olivier Guilyardi <ml@xung.org> wrote:
> Andrew Nagy wrote:
> > Olivier Guilyardi wrote:
> >
> > Help design the datasource driver for DO. Or think about the
> > possibilities of a global datasource driver. My ideas are below for the
> > idea of a global datasource driver. This concept removes the need for a
> > switch detecting what source i am using. The downside is the class is
> > not something that will "do everything" for the app programmer, making
> > the programmer have to think about what "driver" to use. The good, no
> > switch statement that needs to be updated every time we add a new data
> > source as well as the extra processing time. I just came up with a
> > simple decorator patter, let me know if you have any other better design
> > ideas.
>
> So I guess that the developer has to directly do :
>
> $datasource = new Structures_DataGrid_Source_DataObject($dataobject);
>
> Is that right ?
>
If this is so, I'd like to propose something else. It would be best
IMHO to have the data sources auto-included and created for us. Such
as:
$dg->bindDataSource('dataObject', $do);
It would auto-include and create Structures_DataGrid_Source_DataObject
as DG will specify what the includes are named. I've been spoiled by
DB_DO and DB's auto-include method and would like to see them used
everywhere. ;-)
> That's ok with me, although I don't see no decorator pattern below.
>
> Additionnaly, why does S_DG_S_DO::fetch($source) accept this $source
> argument ? It already knows its source...
>
>
> > class Structures_DataGrid_Source_DataObject extends
> > Structures_DataGrid_Source
> > {
> > function Structures_DataGrid_Source_DataObject($source)
> > {
> > parent::Structures_DataGrid_Source($source);
> > }
> >
> > function fetch($source)
> > {
> > }
> >
> > function clear()
> > {
> > }
> >
> > function autoGenerateColumns()
> > {
> > }
> > }
> >
> > class Structures_DataGrid_Source
> > {
> > var $source;
> >
> > function Structures_DataGrid_Source($source)
> > {
> > $this->source = $source;
> > }
> >
> > function fetch()
> > {
> > }
> >
> > function clear()
> > {
> > }
> > }
> >
> > My only request, please don't use one letter variables! I hate them and
> > it makes sense to the creator but means jack to anyone else :)
>
> No problem. I like to use one letter variables in both PHP and C, within short
> functions, but I agree it's sometime confusing. I'll read the PEAR coding
> standards again ;)
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--