79706924

Date: 2025-07-19 04:04:23
Score: 0.5
Natty:
Report link

1 Use Doctrine’s

#[ORM\Column(name: "new_name")]:

#[ORM\Column(name: "new_name", type: "string")] private string $newName;

2. Want Deprecation Warning? → Use Custom Repository:

{
    public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        if (isset($criteria['new_name'])) {
            trigger_deprecation('my-lib', '1.0', '"new_name" is deprecated. Use "newName".');
            $criteria['newName'] = $criteria['new_name'];
            unset($criteria['new_name']);
        }

        return parent::findBy($criteria, $orderBy, $limit, $offset);
    }
}

3. Register the custom repository in the entity:

#[ORM\Entity(repositoryClass: DummyEntityRepository::class)]

No breaking changes. Old keys work. Deprecation warning works. Future-safe.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Zeshan Saqib