1. Go to this page and download the library: Download t4web/domain-module 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/ */
class Task extends \T4webDomain\Entity {
protected $name;
protected $assigneeId;
protected $status;
protected $type;
/**
* @var Users\User\User
*/
protected $assignee;
public function __construct(array $data, Users\User\User $assignee = null) {
parent::__construct($data);
$this->assignee = $assignee;
}
/**
* @return Users\User\User
*/
public function getAssignee() {
return $this->assignee;
}
}
return [
// ...
'entity_map' => [
'Task' => [
// table name
'table' => 'tasks',
// optional, only if you have use short service names
'entityClass' => 'Tasks\Task\Task',
// optional, only if you have use short service names
'collectionClass' => 'Tasks\Task\TaskCollection',
// optional, by default 'id'
'primaryKey' => 'id',
// map entity field with table field
'columnsAsAttributesMap' => [
'id' => 'id',
'name' => 'name',
'assigneeId' => 'assignee_id',
'status' => 'status',
'type' => 'type',
],
// optional, aliases for criteria - for pretty query args
'criteriaMap' => [
'id' => 'id_equalTo'
],
// optional, relations for filtering and fetching aggregate entity
'relations' => [
'User' => ['tasks.assignee_id', 'users.id']
],
],
],
];