Hello,

ezc_bootstrap.php uses the __autoload function, which is overwritten when 
additionally be used with spl_autoload_register, which probably Propel is 
doing.

You musteither  register both autoloading facilities with the function 
spl_autoload_register, to have both autloadings working, or you have to build 
your own __autoload function and depending on the beginning of the classname 
(strpos($className, 'ezc') === 0) call either the ezc autoloader or the propel 
one.

i hope that helps,
Benjamin




On Sunday 29 March 2009 07:57:32 Piotrek Karas wrote:
> Hi all,
>
> Maybe this is more of a Propel problem than eZC problem, but let's see.
>
> I'm trying to incorporate some of the eZComponents (newsest
> pear-installed version) into my appliaction that uses Propel 1.3 in
> runtime. Unfortunately, it seems like they conflict with each other. Any
> one by itself works fine, but when I start both, initiation of one will
> make the other useless. I've tried several ways of including eZC - same
> thing happens.
>
> So, the following code would work:
>
> <?php
> set_include_path( '/usr/local/propel/runtime/classes'
>    . PATH_SEPARATOR . get_include_path() );
> set_include_path( '/var/www/myapp/model/classes'
>    . PATH_SEPARATOR . get_include_path() );
>
> require_once 'ezc/Base/ezc_bootstrap.php';
>
> $iniPath = '/var/www/myapp/settings/conf.ini';
> $ini = ezcConfigurationManager::getInstance();
> $ini->init( 'ezcConfigurationIniReader', $iniPath );
> var_dump( $ini );
>
> require_once 'propel/Propel.php';
> Propel::init( '/var/www/myapp/model/conf/myapp-conf.php' );
>
> // This is a propel class:
> $project = new Project();
> ?>
>
> But of course it doesn't make sense to first use eZC in an application,
> and only then other libraries ;)
> So here's an example of code that would not work:
>
> <?php
> set_include_path( '/usr/local/propel/runtime/classes'
>    . PATH_SEPARATOR . get_include_path() );
> set_include_path( '/var/www/myapp/model/classes'
>    . PATH_SEPARATOR . get_include_path() );
>
> // declarations
> require_once 'ezc/Base/ezc_bootstrap.php';
>
> require_once 'propel/Propel.php';
> Propel::init( '/var/www/myapp/model/conf/myapp-conf.php' );
>
> // application in action
> $iniPath = '/var/www/myapp/settings/conf.ini';
> $ini = ezcConfigurationManager::getInstance();
> $ini->init( 'ezcConfigurationIniReader', $iniPath );
> var_dump( $ini );
>
> $project = new Project();
> ?>
>
> This could would fail, the eZC class will fail:
> Fatal error: Class 'ezcConfigurationManager' not found in
> /var/www/myapp/test.php on line 17
>
> I do realize there's this mechanism for extending autoloads:
> http://ezcomponents.org/docs/tutorials/Base#adding-class-repositories-locat
>ed-outside-ez-components-to-autoload-system
>
> But this would be easy for custom application, but Propel comes with its
> init method for runtime which I don't know how to fix...
>
> Any ideas of how to cope with this?
>
> Cheers,
> Piotrek

-- 
Benjamin Eberlei
http://www.beberlei.de
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to