Organization
Doggy provides complete enterprise organization management using Gedmo Nested Set for tree structures, supporting multi-company, multi-department, and position management.
Entity Model
Organization entities live in src/Entity/Organization/:
| Entity | Table | Description |
|---|---|---|
Corporation | — | Enterprise group |
Company | — | Company |
Department | org_department | Department (Gedmo NestedTree) |
Position | — | Job position |
PositionLevel | — | Position grade |
Employee | — | Employee (also the system user) |
Department Management
Departments use Gedmo NestedTree for unlimited-depth tree structure (src/Entity/Organization/Department.php):
php
#[ORM\Entity]
#[ORM\Table(name: 'org_department')]
#[Gedmo\Tree(type: 'nested')]
class Department implements GedmoNode
{
use CommonTrait;
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
private $id;
#[ORM\Column(length: 100)]
private string $name;
#[ORM\Column(length: 50, nullable: true)]
private ?string $code = null;
#[Gedmo\TreeLeft]
#[ORM\Column(type: 'integer')]
private int $lft;
#[Gedmo\TreeLevel]
#[ORM\Column(type: 'integer')]
private int $lvl;
#[Gedmo\TreeRight]
#[ORM\Column(type: 'integer')]
private int $rgt;
#[Gedmo\TreeRoot]
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $root = null;
#[Gedmo\TreeParent]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
private ?self $parent = null;
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
private Collection $children;
#[ORM\ManyToMany(targetEntity: Employee::class)]
private Collection $manager;
}Department Fields
| Field | Type | Description |
|---|---|---|
| name | string | Department name |
| code | string | Unique code |
| parent | self (NestedTree) | Parent department |
| manager | ManyToMany(Employee) | Department managers |
| company | ManyToOne(Company) | Company |
| type | string | Department type |
| state | string | Enabled/Disabled |
Admin Interface
Controller: App\Controller\Admin\OrgController
Templates: templates/admin/org/
Position Management
Positions are job definitions linked to departments. Templates in templates/admin/org/position/:
- List, create, edit positions
- Grade management (
level_*templates) - Position selectors (
position_modal.html.twig)
Company Management
Corporation: Top-level enterprise groupCompany: Subsidiary company, linked viaCommonTrait'scorporation/companyassociations- Admin templates:
corporation.html.twig,companyEdit.html.twig
Caching
Organization data uses semantic caching strategies with automatic cache invalidation via Doctrine event listeners.