-- MarkDNA <[email protected]> wrote
(on Wednesday, 17 June 2009, 02:10 PM -0700):
> lightflowmark wrote:
> > 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
> >
> > [SNIP]
> >
> > Cheers,
> > Mark
> >
>
> This is a shot in the dark, but have you put /library/DOMPDF into your
> include path and tried to use the ZF autoloader to load everything?
>
> ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR .
> 'library/DOMPDF');
> require_once('Zend/Loader/Autoloader.php');
> $autoloader =
> Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true);
>
> I don't think pushAutoLoader would work if DOMPDF isn't namespaced. Just
> make sure you have your models names different from any DOMPDF class. I tend
> to create wrapper classes for that very reason. Just a suggestion, I'm
> pretty new with the 1.8 autoloader myself!
It will work with or without the namespace. But you need to add the
autoloader either to the spl_autoload registry or to
Zend_Loader_Autoloader in order for it to work; the best situation is to
add it to Zend_Loader_Autoloader, which will ensure it is triggered
prior to any ZF autoloading mechanisms.
You can do it like this:
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->pushAutoloader('whatever_the_dompdf_autoloader_is');
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/