I haven't quite understood what is wrong with instantiating the object. After all, it most probably reflects some external data (or the name wouldn't mean anything). Not creating the object itself won't save you anything. Anyway, you can still do Foo::getName($object_id), if that $object_id corresponds to some external resource like DB row.

Then again, I probably misunderstood you because I don't quite understand the problem to begin with :)

Andi

At 08:59 AM 7/22/2005 +0200, Sebastian Mendel wrote:
Sean Coates wrote:
>> i know this hack, but it does not work, if the statically called method
>> is from the same class as the calling object
>
> Good point. Sorry for not noticing.
> ... I have no idea WHY someone would want to do this.. that said, I
> don't know of a way to do it, either.

a function who returns a name of an object, say its name is

$object->getName();

this needs that the object exists and loaded

how about if i need a name for object not loaded?

Class::getName( $object_id );


there is really no need to load/create the whole object if i only need
the name, so doing

$object = new Class( $object_id );
$object->getName();

would be a waste of system-resources

f.e. the same applies to any other properties of an object stored in a DB.

but why should i choose for the same function two different method-names?

f.e.

Class::getName()
static Class::staticGetName()

??

this doesnt makes sence to me.


pls, give me a hint if i had overseen something.


--
Sebastian Mendel

www.sebastianmendel.de
www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to