我在app.php中有一个白色屏幕但在app_dev.php中没有 在Apache日志上:
PHP致命错误:require():需要打开失败 '[...]的应用程序/高速缓存/ PROD /教义/ ORM /代理\ _ CG _SdzForumBundleEntityCategory.php' (include_path ='。; C:\ php \ pear')in [...] \供应商\原则\ ORM \ LIB \原则\ ORM \代理\ ProxyFactory.php 第92行
我已经尝试过:
当我尝试将供应商包移动到我的源中时问题就开始了,因为开发人员没有更新它: https://github.com/Herzult/HerzultForumBundle
我认为有很多方法可以从数据库中获取信息,而这个论坛包使用了一种我无法掌握的方法。
以下是一些代码
config.yml
doctrine:
orm:
auto_mapping: true
auto_generate_proxy_classes: "%kernel.debug%"
proxy_namespace: Proxies
proxy_dir: %kernel.cache_dir%/doctrine/orm/Proxies
default_entity_manager: default
metadata_cache_driver: array
query_cache_driver: array
result_cache_driver: array
实体/ Category.php
namespace Sdz\ForumBundle\Entity;
use Sdz\ForumBundle\Model\Category as BaseCategory;
use Doctrine\ORM\Mapping as ORM;
/**
*
* @ORM\Table(name="sdz_forum_category")
* @ORM\Entity(repositoryClass="Sdz\ForumBundle\Entity\CategoryRepository")
*/
class Category extends BaseCategory
{
实体/ CategoryRepository.php
namespace Sdz\ForumBundle\Entity;
use Sdz\ForumBundle\Model\CategoryRepositoryInterface;
use Sdz\ForumBundle\Entity\ObjectRepository;
class CategoryRepository extends ObjectRepository implements CategoryRepositoryInterface
{
资源/配置/ orm.xml中
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- Object Manager Service -->
<service id="herzult_forum.object_manager" alias="doctrine.orm.entity_manager" />
</services>
</container>
model.xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- [...] -->
<!-- Topic Repository Service -->
<service id="herzult_forum.repository.topic" class="Sdz\ForumBundle\Model\TopicRepositoryInterface" factory-service="herzult_forum.object_manager" factory-method="getRepository">
<argument type="string">%herzult_forum.model.topic.class%</argument>
</service>
<!-- [...] -->
</services>
</container>
DefaultController.php
//Problem line
$topics = $this->get('herzult_forum.repository.topic')->findBy(array(), array('pulledAt' => 'desc'), 10);
我希望有人可以帮助我。非常感谢至少阅读:)