问题标签 [zend-autoloader]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
819 浏览

php - 在自动加载的实现文件中找不到 PHP 类

我真的希望这不是重复的,但我走了:

我使用 Zend 的自动加载器来加载类。它似乎有效,至少它在实例化我的类(Common_TestTest)时加载了正确的文件,该类在 Common/TestTest.php 中实现。但随后我收到以下错误消息:

“在 Common/TestTest.php 中找不到类 Common_TestTest。”

除了类之外,TestTest.php 中没有任何内容:

get_declared_classes我尝试在文件末尾转储,一切看起来都很好,Common_TestTest是声明的类之一 - 但是离开文件时仍然抛出异常。

最有趣的一点是:当我将类的名称从Common_TestTest更改TestTest为相同的事情时 - 只是错误消息将缺少的类的名称声明为"TestTest". 所以它肯定会看到班级并对它的存在做出反应。

0 投票
1 回答
978 浏览

zend-framework - Zend AutoLoad 自定义目录?

我认为 Zend 中内置了自动加载功能,因此如果您尝试实例化一个类,它将使用类名来尝试查找该类的文件所在的位置。

我希望能够使用自动加载器在我的应用程序的根目录中加载 DTO 目录。我以为我可以为文件 /application/dtos/myClass.php 执行类似 Application_DTO_MyClass 的操作

我试过用谷歌搜索它,但没有发现任何有用的东西。关于最好的方法的任何提示?

0 投票
1 回答
303 浏览

zend-framework - zend 自动加载抽象类

自动加载抽象类的最佳方法是什么

我有一个类 Formprocessor_Userregistrate extends Formprocessor 两个文件都在同一个目录下,但是找不到 Formprocessor

我已经使用了 $autoloader->registerNamespace('Formprocessor_');

当我将 Formprocessor 的名称更改为 Formprocessor_Formprocessor 时;我得到一个“无效的控制器”异常

加载这些抽象类的最佳技术是什么?

谢谢,理查德

0 投票
2 回答
147 浏览

php - 在 zend 应用程序中动态定义 PHP 类

在 Zend 应用程序中,有没有办法定义一个不符合自动加载命名约定的类,并且当我以后尝试使用它时仍然可以识别它?我想你定义了这个类并以某种方式使用自动加载器注册它,但是在阅读了自动加载器手册页之后,我仍然不明白该怎么做。

我的用例是在测试期间(不,在这种情况下我不想要模拟或存根)。我在测试脚本的顶部定义了一个新类,但是当我的应用程序代码引用该类时,autolader 会根据命名约定积极地加载它。

我得到一个寻找 Non/Conforming/Dummy/Class.php 的“没有这样的文件或目录”

0 投票
1 回答
702 浏览

php - Zend Autoloader 无法找到现有文件

我的 Zend 网站出现异常的自动加载问题。到目前为止,自动加载一直是一种享受。不过现在,我在项目中添加了一个新文件,但自动加载却找不到它。我已将问题简化为最小的测试用例,并想知道是否有人可以帮助我。

在我的网站中,我有一个通常的目录结构,如下所示:

我已经正确设置了自动加载(根据 StackOverflow 上的其他有用评论)并注册了 Ext_ 命名空间,这可以通过正确实例化 Ext_Extras_Test 来证明。

当我尝试实例化 Ext_Service_Test 时,问题就来了。自动加载“无法打开流”。我检查了正确的拼写,使用find,ls和文件资源管理器列出了目录内容,以确保文件存在于正确的位置。

我就是无法让它 &^%%£* 找到文件!有没有人有任何线索?

0 投票
1 回答
1418 浏览

zend-framework - 未捕获的异常 'Zend_Application_Bootstrap_Exception' 与消息 '资源匹配 "autoloader" 未找到

我是 Zend 框架的新手。我正在更新由另一个人开发的项目。我收到一个错误,例如

我需要做什么或需要检查什么?有人请帮帮我吗?

谢谢,期待!

0 投票
2 回答
1145 浏览

zend-framework - 在zend框架中自动加载模型,模块内的表单

我的应用结构是这样的:

  • 应用
    • 模块
      • 默认
      • 学生
        • 控制器
        • 形式
          • 学生家长.php
        • 楷模
        • 意见
        • Boostrap.php

我在学生模块的表单文件夹中有一个 studentParent.php。

每当我在学生模块的控制器中调用此表单类时,我都会收到类未找到错误我已将 Bootstrap.php 放在学生模块中。

这是我的 application.ini 文件配置

我的 Bootstrap.php 文件:

0 投票
3 回答
1085 浏览

zend-framework - ZF-Autoloader not working in UnitTests on Ubuntu

i got a problem regarding Unit-testing a Zend-Framework application under Ubuntu 12.04. The project-structure is a default zend application whereas the models are defined as the following

The Problem here is with the Zend-specific autoloading. The naming convention here appears that the folder Mappers loads all classes with _Mapper but not _Mappers. This is some internal Zend behavior which is fine so far.

On my windows machine the phpunit runs without any Problems, trying to initiate all those classes.

On my Ubuntu machine however with jenkins running on it, phpunit fails to find the appropriate classes giving me the following error

The error appears to really be that the Zend-Autoloader doesn't load from the ubuntu machine, but i can't figure out how or why this works. The question remains of why this is. I think i've double checked every point of contact with the zend autoloading stuff, but i just can't figure this out. I'll paste the - from my point of view relevant snippets - and hope someone of you has any insight to this.

Jenkins Snippet for PHPUnit

./tests/phpunit.xml

./tests/bootstrap.php

Any help will be appreciated.

0 投票
1 回答
502 浏览

zend-framework - 在 zend 框架中使用 SoapClient、ArrayObject、ArrayIterator 会导致错误

我正在我的实体中研究一些有用的方法。

警告:require(App/Entity/SoapClient.php):无法打开流:第 148 行的 /zendboilerplate/library/Doctrine/Common/ClassLoader.php 中没有这样的文件或目录致命错误:require():打开失败需要' App/Entity/SoapClient.php' (include_path='/zendboilerplate/application/../library:/zendboilerplate/application/../library/Bisna/Application/Resource:/zendboilerplate/library:.:/usr/share/ php:/usr/share/pear') 在第 148 行的 /zendboilerplate/library/Doctrine/Common/ClassLoader.php 中似乎 zend 寻找一个类声明(并且它不使用 php 中包含的类)。

每个“类”声明的相同错误。使用库中包含的我自己的类,一切正常。(也尝试使用 @new SoapClient() 但没有结果)。

0 投票
2 回答
5089 浏览

php - PHPUnit 代码覆盖率如何忽略我的自动加载器?

我的 phpunit 配置中有一个引导程序,它运行Zend\Loader\StandardAutoloader.php. 当我添加时,我可以获得 PHPUnit 代码覆盖以忽略它

到 PHPUnit 配置 XML 文件。但我必须指定一个绝对路径。我希望它是一个相对路径,但 PHPUnit 不会忽略代码覆盖中的 Zend 文件夹。我不想为在家工作时添加不同的位置,也不希望其他开发人员添加自己的路径。Zend 框架位于 php.iniinclude_path设置中,但这不起作用:

有什么建议么?