I'm having this construction for using different frameworks together.
function __autoload($class)
{
if ('ezcBase' == $class)
{
require_once 'Base/src/base.php';
}
else if ('ezc' == substr($class, 0, 3))
{
ezcBase::autoload($class);
}
else if ('Zend' == substr($class, 0, 4) || 'Custom' ==
substr($class, 0, 6))
{
Zend::loadClass($class);
}
else if ('Doctrine' == substr($class, 0, 8) ) {
Doctrine::autoload($class);
}
//echo $class."<br>";
}
Antalóczy Tibor schreef:
Has anyone tried Doctrine and ZF together? I wanted to do a little
test today, but I run into trouble: ZF autoload was trying to handle
Doctrine autoload tasks. If I removed all ZF parts, the Doctrine was
running nicely, but the two together had some problem. Since I have no
experience in developing frameworks, I had no chance to debug the
problem. I used the following lines to initiate the autoloading (of
course, after the inclusion of Zend.php and Doctrine.php):
spl_autoload_register(array('Doctrine', 'autoload'));
spl_autoload_register(array('Zend', 'loadclass'));
I don't have experience in using two complicated software packages
together. Where should I look for the error? What are the main rules
for these kind of projects? (I have been using ZF on production sites
since April 2006, and I had no major problems so far.)
Best regards,
Tibor
Michael Sheakoski írta:
Count me in as one of the many frustrated by the lack of late static
binding. I actually ended up doing quite a few projects in Rails
because it was just becoming way to hard to maintain in PHP with all
the extra code to work around the issue. After converting one of my
PHP-based models into a Ruby/ActiveRecord model my code dropped from
500 lines down to 80. The benefits are obvious so I wonder why it
isn't a higher priority to push this feature into PHP?
A few days ago a friend of mine pointed me to a nice ORM library
which I think would fit in well with ZF. It is called Doctrine (
http://www.phpdoctrine.com/ ). It is designed from the ground up for
PHP5 and PDO and doesn't use XML config files to map tables. Perhaps
the ZF developers should talk to the Doctrine people about
incorporating it into the framework or using some of its ideas in a
"ZActiveRecord" implementation. Until a solution for late static
binding is found this seems to be the best option.
Michael Sheakoski
Allan Vernon wrote:
Hi Steph,
Thanks for this masterful summary. I'm sorry about the name
confusion; however, the 1st letter was correct.
It looks like late static binding has become bogged in April.
However, there are many clever people contributing to the framework
and I'm hopeful that someone such as Martel, Mathew, Bill, Thomas
etc might, if they see the need for late static binding, help Mike,
Dmitry and Jochem with the patch that is needed for PHP ?5.3 or 6.
As someone once intimated , the Zend Framework may help to drive
PHP faster ; and this may be a case in point.
Allan Vernon
Steph Fox wrote:
Hi Allan,
Dmitry Stogov worked with Mike on his late static binding patch
_last March_ and posted it for review. The problem with it was that
it slowed down PHP too much to be useful. Mike hasn't - so far
anyway - come up with anything since - but it was only ever
intended to be explored for PHP 6 anyway. Please don't read that as
any kind of guarantee it'll be in PHP 6.
http://devzone.zend.com/node/view/id/1483#Heading4
That was the last material reference to it on-list.
- Steph (not Sara :)
----- Original Message ----- From: "allan vernon"
<[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Saturday, January 20, 2007 9:58 AM
Subject: [fw-general] RE: Late static binding for PHP 5
The quotation came from the summary minutes of the Paris Developer's
Meeting(?PDM you referred to). I presume that the Marcus, referred
to in
conclusion 2. of the quotation, was Marcus Börger (SOMABO) who was
going to
prepare an implementation suggestion.
I thought that I read in one of Sara Goleman's more recent
summaries that
late static binding was still on the agenda for PHP 6. Can't find
it at the
moment though.
Mike Lively in his August 24 2006 blog had the following note:
Late Static Binding
I haven't been able to touch this in what seems like ages and have
(unfortunately) completely missed the boat for PHP 5.2. But I am
hoping to
take a look at the current patch, come up with some solid use cases
and
tests, and submit the whole package to PHP Internals for review.
Andi Gutmans wrote:
What's the last you've heard of that? Is it the PDM summary?
I have not found a good way to implement this in PHP and am not
quite sure
it will be in PHP 6.