dongyun8138 2010-12-21 16:28
浏览 27

CakePHP常见的型号

I have 3-4 apps running of the same Cake library, each app has its own controllers, models and views.

I have found recently that quite a few methods within the models overlap between projects, i was wondering if it was possible to get the app models (not app_model.php) to extend the models in the cake files

e.g.

app1
    controllers
    models
        model_1.php
        model_2.php
    views
app2
    controllers
    models
        model_1.php
        model_3.php
    views
cake
    controllers
    models
        model_1.php
    views

I hope that makes sense

  • 写回答

4条回答 默认 最新

  • dongzhuo6137 2010-12-21 16:36
    关注

    If you're using CakePHP 1.3, then you can modify your bootstrap.php file:

    App::build(array(
        ...
        'models' =>  array('/var/www/app1/models/', '/var/www/cake/models/'),
        ...
    ));
    

    But I think you'd have to rename them differently, i.e. you can't have model_1.php in both places. But you could have vehicle.php in your cake/models folder, car.php in your cars_app/models folder & bike.php in your bikes_app/models folder with the models extending the Vehicle model.

    I haven't tested it, but give it a shot!

    评论

报告相同问题?

悬赏问题

  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题