armenio/zf3-cake-orm

Cake ORM Module for Zend Framework

1.8.1 2021-07-22 21:39 UTC

This package is auto-updated.

Last update: 2021-09-22 22:04:11 UTC


README

Cake ORM Module for Zend Framework

How to install

  1. Install via composer. Don't know how? Look here

  2. cd my/project/directory

  3. Edit composer.json :

{
	"require": {
		"armenio/zf3-cake-orm": "1.*"
	}
}
  1. Edit config/application.config.php :
'modules' => array(
	 'Application',
	 'Cake', // <==============================
)
  1. 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!
			),
		),
	),
  1. 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);
}