Entity does not exist: Pyz prefix
Edit on GitHubWhen running an upgrade, you can get an error about a non-existent constant, class, method, or property. It’s caused by the name of the entity containing the pyz prefix.
Error example
Constant does not exist because the existent constant has PYZ_ prefix.
Solution
Remove pyz from the names of the entities:
- Constant
- Class
- Method
- Property
Rename constants
- Replace
const PYZ_withconst. - Replace
::PYZ_with::. - Rename constant values that start with
PYZ_. - Remove constants that override the same parent constant with the same value.
Rename transfers
-
In the
sharedfolder, replace the following for*.xmltransfers files:"(pyz)(.)(\w*)with"\L$2\E$3"(Pyz)(.)(\w*)with"$2E$3
-
In
*.phpfiles, replace theTransfer\->(get|set|require)Pyzregexpa withTransfer->$1. -
In
*.twigfiles, removepyzin transfer getters like.getPyzor.pyz.
Rename DB schemas
Naming convention
According to our naming convention, all custom tables must be prefixed with pyz_
Remove pyz_ in *.xml schema files.
Rename methods
- Replace the
on (get|set|add|map)Pyzregexp withon $1. - Replace the
\->(get|set|add|map)Pyzregexp with->$1. - Replace
class Pyzwithclass. - Replace
BasePyzwithBase. - Replace the
([a-z])Pyz([A-Z])regexp with$1$2.
Rename variables and class names
- Search by the
\w\\Pyzregexp,Pyz(,: Pyz,(Pyzand removepyz. - Search by the
(?<!(namespace |use |@[a-z]+ \\))(Pyz|pyz)rexexp and remove all thepyzoccurrences.
Verify the changes
- Use phpstan to identify missed occurrences of
pyz. If any found, rename or remove. - Manually check the project base functionality.
- Run the CI and make sure it’s green.
Thank you!
For submitting the form