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.

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

报告相同问题?

悬赏问题

  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制