Hi,
I feel I'm missing something with Zend_Loader_Autoload, as I can't make it
do what I want!

I think the relevant points are:
1)  my models are are in a models directory and are not prefixed -
models/SomeTable.php contains class SomeTable extends
Zend_Db_Table_Abstract, etc.

2) I'm using a 3rd-party library which has it's own autoloader, and also
does not use prefixes (DOMPDF), living in /library/DOMPDF

3) My models are loaded fine by Zend_Loader with no intervention on my part,
all very straighforward.  However, when I need to use the 3rd-party library,
I want to be able to register the new autoloader such that classes are
autoloaded first from my models directory or failing that, from
/library/DOMPDF.  So I can call $class = new SomeTable() (using Zend_Loader)
or $class = new class_in_DOMPDF() (using DomPDF::autoload()) and have them
both work.

The only way I have been able to make this work is to unregister
Zend_Loader::autoload and register DOMPDF::autoload; after I've finished
with the class, I have to unregister DOMPDF::autoload & re-register
Zend_Loader::autoload.  If I don't do this, then I get errors from one
autoloader or the other about not being able to find classes which should
properly be loaded by the other autoloader.

I don't want to prefix my models with anything (because it would be a huge
amount of work to retrofit this), and I don't want to have to prefix every
class in DOMPDF (as it will be a huge amount of work and also break on
upgrades).

How should I do this?  I'm certain my approach is missing the point fairly
badly!

Cheers,
Mark
-- 
View this message in context: 
http://www.nabble.com/Autoloader-confusion-tp24030297p24030297.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to