1. Go to this page and download the library: Download doomy/ormtopus 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/ */
doomy / ormtopus example snippets
namespace App\Client\Model;
use Doomy\Repository\Model\Entity;
use Doomy\Repository\TableDefinition\Attribute\Column\Identity;
use Doomy\Repository\TableDefinition\Attribute\Column\PrimaryKey;
use Doomy\Repository\TableDefinition\Attribute\Table;
#[Table('test_table')]
class Client extends Entity
{
#[PrimaryKey]
#[Identity]
private ?int $id;
public function __construct(?int $id = null) {
$this->id = $id;
}
public function getId(): ?int
{
return $this->id;
}
}
final class DashboardPresenter extends Nette\Application\UI\Presenter
{
private $data;
public function __construct(DataEntityManager $data)
{
$this->data = $data;
parent::__construct();
}
public function renderIndex()
{
$this->template->clients = $this->data->findAll(Client::class);
}
}