armenio / zf3-cake-orm
Cake ORM Module for Zend Framework
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
Cake ORM Module for Zend Framework
How to install
-
Install via composer. Don't know how? Look here
-
cd my/project/directory
-
Edit composer.json :
{ "require": { "armenio/zf3-cake-orm": "1.*" } }
- Edit config/application.config.php :
'modules' => array( 'Application', 'Cake', // <============================== )
- Change your Model namespace in 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! ), ), ),
-
Create your models
6.1. Go to my/project/directory/your/app/namespace
6.2. Create directory Model/Table/
6.3. Go to my/project/directory/your/app/namespace/Model/Table/
6.4. Create the File MyTable.php
<?php namespace Application\Model\Table; use Armenio\Cake\ORM\Table; class MyTable extends Table { // ... }
See more here: http://book.cakephp.org/3.0/en/orm.html
How to use
<?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); }