armenio/zf3-cake-orm

The Cake ORM Module for Zend Framework 3

1.7.1 2020-02-04 21:31 UTC

This package is auto-updated.

Last update: 2020-02-04 22:55:15 UTC


README

The Cake ORM Module for Zend Framework 3

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);
}