tags:

views:

109

answers:

3

i am having a situation where my doctrine model, Post, is in the namespace Application\Entities and i want to try to implement Zend_Acl_Resource_Interface. i get the error

Fatal error: Interface 'Application\Entities\Zend_Acl_Resource_Interface' not found in D:\Projects\Websites\php\ZendFram ework\LearningZF\library\Application\Entities\Post.php on line 8

namespace Application\Entities;
use DoctrineExtensions\NestedSet\Node;

/**
 * @Entity @Table(name="posts")
 */
class Post implements Node, Zend_Acl_Resource_Interface {

update

if i try

class Post implements Node, \Zend_Acl_Resource_Interface {

Fatal error: Interface 'Zend_Acl_Resource_Interface' not found in D:\Projects\Websites\php\ZendFramework\LearningZF\library\Application\Entities\Post.php on line 8

A: 

As far as I remember Zend Framework does not uses namespaces (until 2.x comes out anyway) so it's classes are in global namespace. Try class Post implements Node, \Zend_Acl_Resource_Interface {

Mchl
i tried that but got 'Interface 'Zend_Acl_Resource_Interface' not found ' strange see my update ...
jiewmeng
+2  A: 

Are you using the ZF 2.0 branch or the stable one, e.g. 1.10? Is your autoloader setup to load classes with the ZF naming scheme?

You can use the Conversion tool the ZF devs used to convert ZF to using namespaces:

Gordon
i am using ZF1.10. oh but 2.0 is out, i know its in development, but i guess theres not docs to help me get started? isit ... erm ... usable at least for me to start learning it? or isit giving errors everywhere? i'll check out the links tho
jiewmeng
@jiewmeng it's not officially out. Just like Doctrine is still in beta.
Gordon
Doctrine works great so far for me :) ok back to the tool. i created the php 5.3 namespaced ZF1.10. i want to start using it. i guess all i have to do is convert all PEAR namespaces to real namespaces. in the process of conversion, i was looking up `Zend_Controller_Plugin_ErrorHandler` in the mapping xml but cant find it ...
jiewmeng
... i see that alot of paths are invalid? cos things like `Zend/Application.php` becomes `Zend/Application/Application.php`?
jiewmeng
Gordon
A: 

i am going to put this as an answer, so i can mark this qn as answered if noone have any other answers, its actually a workaround i used. i am not too sure why it worked exactly, or rather why the Zend autoloader failed

i added the require_once to include Zend_Acl_Resource_Interface

namespace Application\Entities;
use DoctrineExtensions\NestedSet\Node;
require_once "Zend/Acl/Resource/Interface.php";

/**
 * @Entity @Table(name="posts")
 */
class Post implements Node, \Zend_Acl_Resource_Interface {

i think a better fix will be to conversion tool in @Gordon's answer. but i cant fix all the errors i get with "unclean" conversion yet. paths are broken.

jiewmeng