armenio / zf3-cake-orm
Zend Framework 的 Cake ORM 模块
1.8.1
2021-07-22 21:39 UTC
Requires
- php: ^5.6 || ^7.0
- cakephp/cache: 3.*
- cakephp/log: 3.*
- cakephp/orm: 3.*
- container-interop/container-interop: ^1.1
- jeremyharris/cakephp-lazyload: 2.*
- zendframework/zend-cache: ^2.7.1
- zendframework/zend-db: ^2.8.1
- zendframework/zend-mvc: ^3.0.1
- zendframework/zend-paginator: ^2.7
Requires (Dev)
- squizlabs/php_codesniffer: ^3.5.3
README
Zend Framework 的 Cake ORM 模块
如何安装
-
通过 composer 安装。不知道如何操作?请查看这里 https://getcomposer.org.cn/doc/00-intro.md#introduction
-
cd my/project/directory
-
编辑 composer.json
{ "require": { "armenio/zf3-cake-orm": "1.*" } }
- 编辑 config/application.config.php
'modules' => array( 'Application', 'Cake', // <============================== )
- 在 cd my/project/directory/vendor/armenio/zf3-cake-orm/config/module.config.php 中更改您的模型命名空间
'Cake' => array( 'Configure' => array( 'App' => array( 'namespace' => 'Application' // <======= put your App/Module namespace HERE! ), ), ),
-
创建您的模型
6.1. 前往 my/project/directory/your/app/namespace
6.2. 创建目录 Model/Table/
6.3. 前往 my/project/directory/your/app/namespace/Model/Table/
6.4. 创建文件 MyTable.php
<?php namespace Application\Model\Table; use Armenio\Cake\ORM\Table; class MyTable extends Table { // ... }
更多信息请查看: https://book.cakephp.com.cn/3.0/en/orm.html
如何使用
<?php use Armenio\Cake\ORM\TableManager; $tableManager = new TableManager(); $table = $tableManager->get('MyTable'); $items = $table->find('all')->all(); foreach ($items as $row) { var_dump($row); }