-- Denis Fohl <[EMAIL PROTECTED]> wrote
(on Thursday, 24 April 2008, 04:56 PM +0200):
> sorry i forgot the subject in my previous post :
>
> i'm trying to implement a class to manage manytomany relationships in
> backoffice, i'd like to standardize it for reusability.
> I would like to pass to the constructor of my class the name of the
> tables involved (destination table, origin table, intersection table)
> and that it instantiate correspondings Zend_Db_Table objects.
>
> So now is the question : how can i instantiate an object (Zend_Db_Table
> here) with a variable classname :
>
> function __construct ($originTable, $destinationTable) {
>
> $table1 = new $originTable();
The above works, and we use this in many places in ZF. If you need to
prepend a class prefix, you may want to look at
Zend_Loader_PluginLoader; if you need to normalize the name to fit
naming standards, look at Zend_Filter_Inflector. We use both of these
throughout ZF for plugin loading.
> ...
>
> }
>
> i can't find what i want on google (tried call_user_func but that's not it).
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/