doctrine
Skill0 starsChanged 3 months agoMITView on GitHub
Use when working with modern versions of the Doctrine Object Relational Mapper (ORM) or Doctrine Database Abstraction Layer (DBAL)
3 other projects use a version of this.
Adopted by
Most recently taken up by
- scottcrosby-securebine/doctrine-skillstheir own version, first seen Oct 3, 2026
- riddhimohansharma/codebase-kb-enginetheir own version, first seen Oct 1, 2026
- telagod/code-abysstheir own version, first seen Jul 6, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- telagod/code-abyss★ 242same name
- riddhimohansharma/codebase-kb-engine★ 0same name
- scottcrosby-securebine/doctrine-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- phpSkill
- richSkill
- symfony-aiSkill
- symfonySkill
- web-designSkill
The file
Files
Doctrine skill
This skill outlines how to use the Doctrine ORM and DBAL in a modern PHP application. Though not always, you will frequently find Doctrine used in the context of a Symfony application.
Documentation links
- Doctrine Object Relational Mapper (ORM): https://www.doctrine-project.org/projects/doctrine-orm/en/3.6/index.html
- Doctrine DBAL (Database Abstraction Layer): https://www.doctrine-project.org/projects/doctrine-dbal/en/4.4/index.html
Entity conventions
Ensuring that entities are "structured" well is important, especially as an application grows. All entities should follow this general layout:
<?php
namespace App\Entity;
use App\Repository\AccountRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Attribute\Ignore;
use function max;
use function nullify;
use function strtolower;
#[ORM\Entity(AccountRepository::class)]
#[ORM\HasLifecycleCallbacks]
class Account implements \Stringable
{
/**
* @var ?non-negative-int
*/
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['read', 'read:event'])]
private ?int $id = null;
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
#[Groups(['read', 'read:event'])]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\Column(type: Types::DATETIMETZ_IMMUTABLE)]
#[Groups(['read', 'read:event'])]
private ?\DateTimeImmutable $updatedAt = null;
/**
* @var ?non-empty-string
*/
#[ORM\Column(type: Types::TEXT)]
#[Groups(['read', 'read:event'])]
private ?string $name = null;
/**
* @var ?non-empty-lowercase-string
*/
#[ORM\Column(type: Types::TEXT)]
#[Groups(['read', 'read:event'])]
private ?string $email = null;
/**
* @var Collection<int, User>
*/
#[ORM\OneToMany(targetEntity: User::class, mappedBy: 'account', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['id' => 'ASC'])]
#[Groups(['read:account:users'])]
private Collection $users;
public function __construct()
{
$this->setCreatedAt(new \DateTimeImmutable());
$this->setUpdatedAt(new \DateTimeImmutable());
$this->users = new ArrayCollection();
}
/**
* @return ?non-negative-int
*/
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): static
{
$this->id = max(0, $id);
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTimeImmutable $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return ?non-empty-string
*/
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = nullify($name);
return $this;
}
/**
* @return ?non-empty-lowercase-string
*/
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
if ($email = nullify($email)) {
$email = strtolower($email);
}
$this->email = '' !== $email ? $email : null;
return $this;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): static
{
if (!$this->users->contains($user)) {
$this->users->add($user);
$user->setAccount($this);
}
return $this;
}
public function removeUser(User $user): static
{
if ($this->users->removeElement($user)) {
if ($user->getAccount() === $this) {
$user->setAccount(null);
}
}
return $this;
}
#[ORM\PreUpdate]
public function preUpdate(): void
{
$this->setUpdatedAt(new \DateTimeImmutable());
}
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

