Thank you for your response Vincent,
for now, i have no other solution than instantiate the object before
calling my constructor and pass the Zend_Db_Table objects to it instead
of passing strings with their names... but it's not exactly what i
wanted to do.
cheers
Vincent a écrit :
On 4/24/08, *Denis Fohl* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi all,
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();
...
}
i can't find what i want on google (tried call_user_func but that's
not it).
This sounds similar to something I've been trying to do a while ago.
After reading a *lot* about this, I found out this was not possible
before PHP 5.3. I'm not sure exactly where I found that, but a good
starting point would be the comments on http://nl3.php.net/get-class .
Thanks.
Denis.
Best of luck,
--
Vincent
--
Denis Fohl
--------------
df-info
06 84 38 21 99