Chris wrote:
You'll need to:
$dbtoy = new DBToyExt();
$dbtoy->connect()
$dbtoy->testext('testing');
But you cannot do:
$dbtoy = new DBToyExt();
$dbtoy->connect()
$dbtoy->testext('testing');
$result = $dbtoy->query('SELECT...');
//[...]
You have to do something like this:
$dbtoy =
[EMAIL PROTECTED] wrote:
Ahhh! I'd kept thinking what connect() returned was a db object, but it does
look like
it returns varying objects depending on which database you're using.
correct
Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods
would
be inhereted by an
> > So... I'm trying to extend PEAR::DB. It'd be great to keep everything it
> > offers and just add a few more perhaps unconventional functions.
> >
> > $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL
> > PROTECTED]/weston_tssa");
> >
>
> DB::connect() is actually a factory call. So
[EMAIL PROTECTED] wrote:
Weston wrote:
$dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL PROTECTED]/weston_tssa");
$dte->testext('testing');
$dte->testext($dte->moo);
$dte->testext($dte->bar);
>>>
$dte will only have the return value of DBToyExt::connect() - it won't
allow you to access
Weston wrote:
> > $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL
> > PROTECTED]/weston_tssa");
> >
> > $dte->testext('testing');
> > $dte->testext($dte->moo);
> > $dte->testext($dte->bar);
On Fri, Mar 10, 2006 at 10:43:02AM +1100, Chris wrote:
> $dte will only have the return value of
[EMAIL PROTECTED] wrote:
So... I'm trying to extend PEAR::DB. It'd be great to keep everything it offers and just add a few more perhaps unconventional functions.
Intuitively, it seemed like this approach might work:
testext('testing');
$dte->testext($dte->moo);
$dte->testext($dte->bar
Is the include in your class 2 file the very first line, before you
start declaring your class 2 classes? The class 1 file has to be loaded
before you start extending it, obviously, but just checking.
The other problem may be with your paths. Wherever your template file
is located is where is
Charles Kline wrote:
On May 25, 2005, at 7:53 PM, Richard Lynch wrote:
On Wed, May 25, 2005 11:30 am, Charles Kline said:
i have 2 class files. say for example.
class 1
class 2 extends class 1
class 2 uses include_once("firstclass.php")
include, require, etal are not functions exactly.
On May 25, 2005, at 7:53 PM, Richard Lynch wrote:
On Wed, May 25, 2005 11:30 am, Charles Kline said:
i have 2 class files. say for example.
class 1
class 2 extends class 1
class 2 uses include_once("firstclass.php")
then i use include_once ("secondclass.php") in my template. this does
no
On Wed, May 25, 2005 11:30 am, Charles Kline said:
> i have 2 class files. say for example.
>
> class 1
>
> class 2 extends class 1
>
> class 2 uses include_once("firstclass.php")
>
> then i use include_once ("secondclass.php") in my template. this does
> not work. to get it to work, i must put bo
* Jason Barnett <[EMAIL PROTECTED]>:
> Matthew Weier O'Phinney wrote:
> > * Phillip S. Baker <[EMAIL PROTECTED]>:
> ...
> > The object *instance* only gets to access the overridden method (assuming
> > it's an instance of the child class):
> >
> > $instance->someMethod();
> >
>
> This is 100%
Matthew Weier O'Phinney wrote:
* Phillip S. Baker <[EMAIL PROTECTED]>:
...
The object *instance* only gets to access the overridden method (assuming
it's an instance of the child class):
$instance->someMethod();
This is 100% correct, but just to clarify: it is possible to do
something like thi
* Phillip S. Baker <[EMAIL PROTECTED]>:
> Thank you,
>
> This makes allot of sense.
> However one last question about this.
>
> If I access the overrided function from the child class do I access it by.
>
> $instanceofchildclass->parent::someMethod();
>
> OR would I still simply just call it
>
> $i
Thank you,
This makes allot of sense.
However one last question about this.
If I access the overrided function from the child class do I access it by.
$instanceofchildclass->parent::someMethod();
OR would I still simply just call it
$instanceofchildclass->someMethod();
And it would get to use
Brent Baisley wrote:
You're absolutely correct. I was debating on whether to get into
inheritance and overloading. I just settled on what PEAR tends to use
rather than go into more detail.
Are you referring to the PEAR::isError (and similar function calls) that
you see all over the place in PEAR
Your email prompted me to think about architecture. What I have is;_
a database class which is the only class with direct access to the database.
a table class, which is passed the database class on instantiation.
a presenter class which is passed the table class during instantiation.
This m
You're absolutely correct. I was debating on whether to get into
inheritance and overloading. I just settled on what PEAR tends to use
rather than go into more detail.
Thanks for clarifying.
On Jan 21, 2005, at 11:18 AM, Matthew Weier O'Phinney wrote:
* Brent Baisley <[EMAIL PROTECTED]> :
You've
* Brent Baisley <[EMAIL PROTECTED]> :
> You've got most of it. Just adding "extends MySQL" to your page result
> class will allow you to access all function in the MySQL class. I
> usually reference functions in the parent class like this:
> parent::FunctionName()
This is a bad practice when inh
You've got most of it. Just adding "extends MySQL" to your page result
class will allow you to access all function in the MySQL class. I
usually reference functions in the parent class like this:
parent::FunctionName()
You still reference functions in the current class using $this->, that
way y
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then S.Murali Krishna declared
>
> Hi
> Instead of extending the class you can create a language object
> inside 'form' class and refer it for all your stuffs regardless of
> language.
>
> class form
> {
> function form($lang)
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* and then Simon Willison declared
> Another different of doing the same kind of thing would be to use an
> "object factory" as seen in the PEAR DB abstraction layer. This works by
> having a static class method (i.e a method that can be called
Hi
Instead of extending the class you can create a language object
inside 'form' class and refer it for all your stuffs regardless of
language.
class form
{
function form($lang)
{
if($lang == "dk") { $this->lang = new dk(); }
else if ($lang == "en") { $this->lang = ne
Nick Wilson wrote:
>So I was thinking:
>
>$form=new form('dk')
>
>Would extend the class to include all the dk language routines and
>
>$form=new form('en')
>
>Would do likewise for english.
>
You can do this with encapsulation. Your "form" object would actually be
a wrapper around an encapsulat
23 matches
Mail list logo