【问题标题】:Unknown parser class "PropelArrayParser"未知的解析器类“PropelArrayParser”
【发布时间】:2014-11-27 17:09:38
【问题描述】:

我是 Propel 的新手,我需要使用已经使用 Propel (1.6.9) 设置的网站。 我在我的笔记本电脑上得到了这个工作,并且没有任何错误生成。 (耶!)

在生成类后(在与之前相同的 schema.xml 和其他相关文件上)似乎存在一些差异。 (发现文件大小)当我将这些文件上传到旧文件做得很好的虚拟主机时,我遇到了一个错误:

Fatal error: Uncaught exception 'PropelException' with message 'Unknown parser class "PropelArrayParser"' in /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/vendor/propel/propel1/runtime/lib/parser/PropelParser.php:101 

Stack trace: 
#0 /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/vendor/propel/propel1/runtime/lib/om/BaseObject.php(375): PropelParser::getParser('Array') 
#1 /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/vendor/propel/propel1/runtime/lib/om/BaseObject.php(424): BaseObject->exportTo('Array', 'fieldName') 
#2 /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/src/controllers/UsersController.php(26): BaseObject->__call('toArray', Array) 
#3 /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/src/controllers/UsersController.php(26): User->toArray('fieldName') 
#4 /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/framework/framework.php(196): require('/var/www/vhosts...') 
#5 /var/www/vhosts/10/154462/web in /var/www/vhosts/10/154462/webspace/httpdocs/DOMAIN/vendor/propel/propel1/runtime/lib/parser/PropelParser.php on line 101

错误指的是:

$case = new AgencyCosts();
$case->fromArray($_POST, BasePeer::TYPE_FIELDNAME);
$case->save();

所以我认为包含有问题。这就是为什么我在我的 init.php 中添加了以下内容:

set_include_path(dirname(DIR) . '/vendor/propel/propel1/runtime/lib/parser' . PATH_SEPARATOR . get_include_path());

需要目录名(DIR)。 '/vendor/propel/propel1/runtime/lib/parser/PropelJSONParser.php';

没有任何成功。

init.php(包含完成的地方)可用here。 任何帮助将不胜感激。

【问题讨论】:

    标签: php propel


    【解决方案1】:

    当 Propel 找不到类定义时,您会收到此异常。来自 Propel 的代码:

    // PropelParse::getParser
    if (!class_exists($class)) {
        throw new PropelException(sprintf('Unknown parser class "%s"', $class));
    }
    

    Propel 生成一个类映射文件,其中写入了所有 Propel 类的路径。似乎您只是在其中包含错误的文件或错误的路径。查看classmap 键的配置文件:

    $conf['classmap'] = include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'classmap-<you-project-name>-conf.php');
    

    然后检查该文件的内容。这可能是因为您盲目地将文件从计算机移动到服务器。

    【讨论】:

      猜你喜欢
      • 2013-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-11
      • 2013-10-21
      • 2016-08-31
      • 2019-10-17
      • 1970-01-01
      相关资源
      最近更新 更多