1. Go to this page and download the library: Download cakephp/orm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Cake\ORM\Locator\TableLocator;
$locator = new TableLocator();
$articles = $locator->get('Articles');
use Cake\ORM\Locator\LocatorAwareTrait;
$articles = $this->getTableLocator()->get('Articles');
use Cake\ORM\Locator\TableLocator;
use Cake\ORM\Locator\LocatorAwareTrait;
$locator = new TableLocator();
$this->setTableLocator($locator);
$articles = $this->getTableLocator()->get('Articles');
use Cake\ORM\Locator\LocatorAwareTrait;
$articles = $this->getTableLocator()->get('Articles');
foreach ($articles->find() as $article) {
echo $article->title;
}
// in src/Data/Table/ArticlesTable.php
namespace Acme\Data\Table;
use Acme\Data\Entity\Article;
use Acme\Data\Table\UsersTable;
use Cake\ORM\Table;
class ArticlesTable extends Table
{
public function initialize()
{
$this->setEntityClass(Article::class);
$this->belongsTo('Users', ['className' => UsersTable::class]);
}
}
use Acme\Data\Table\ArticlesTable;
use Cake\ORM\Locator\TableLocator;
$locator = new TableLocator();
$articles = $locator->get('Articles', ['className' => ArticlesTable::class]);
use Cake\Core\Configure;
Configure::write('App.namespace', 'Acme');
use Cake\Core\Configure;
Configure::write('App.namespace', 'My\Log\SubNamespace');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.