dongqiuwei8667 2016-06-01 10:46
浏览 25
已采纳

推动ORM和PHP

I am making a php application using propel ORM. It gives me the following message when I try to run it:

Fatal error: Uncaught Error: Class 'Propel\Runtime\Propel' not found in C:\MAMP\htdocs\Conference\vendor\bin\generated-conf\config.php:2 Stack trace: #0 C:\MAMP\htdocs\Conference\vendor\bin\list.php(6): require_once() #1 {main} thrown in C:\MAMP\htdocs\Conference\vendor\bin\generated-conf\config.php on line 2.

In my config.php generated file I have this written:

'classname' => '\\Propel\\Runtime\\Connection\\ConnectionWrapper'

What does it all mean? Am I missing some file or what?

  • 写回答

1条回答 默认 最新

  • dongyu3712 2016-06-13 05:21
    关注

    I think you are missing a step in the building. I assume you have your schema.xml file complete and you also have a propel.yaml (or with allowed extension file) properly configured. Also I assume you got Propel with Composer. If you have all that the next steps are:

    1) Open a terminal and go to your project directory, where the schema.xml and propel.yaml files are.

    2) Execute the following command to get yout generated-sql (I have to do it this way on Windows):

    c:\MAMP\htdocs\Conference\vendor\bin\propel sql:build
    

    3) Get your model classes with the following command:

    c:\MAMP\htdocs\Conference\vendor\bin\propel model:build
    

    4) After generating the classes, you have to autoload them. Open your composer.json file with your text editor and add the following:

    "autoload": {
        "classmap": ["generated-classes/"]
    }
    

    It should look like this, for example:

    {
        "require": {
            "twig/twig": "~1.0",
            "propel/propel": "~2.0@dev"
        },
    
        "autoload": {
            "classmap": ["generated-classes/"]
        }
    }
    

    5) To finish the classes autoloading, you need to execute on your console:

    composer dump-autoload
    

    6) And for the runtime connection settings run this for comunicate classes at runtime:

    c:\MAMP\htdocs\Conference\vendor\bin\propel config:convert
    

    7) Assuming you have created your database, the last thing you need to do is create the tables, this is with the following command:

    c:\MAMP\htdocs\Conference\vendor\bin\propel sql:insert
    

    And there you go! That works for me every time I build a project.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥15 关于logstash转发日志时发生的部分内容丢失问题
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题