Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented enumType class for admin status column #216

Draft
wants to merge 1 commit into
base: 4.0
Choose a base branch
from
Draft

Conversation

kakapiciu
Copy link
Member

#212 2.2

Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (2eb6e2d) 65.22% compared to head (40524b9) 64.88%.
Report is 27 commits behind head on 4.0.

Files Patch % Lines
src/Admin/src/Entity/EnumAdminStatus.php 0.00% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                4.0     #216      +/-   ##
============================================
- Coverage     65.22%   64.88%   -0.34%     
- Complexity      363      367       +4     
============================================
  Files            49       50       +1     
  Lines          1734     1743       +9     
============================================
  Hits           1131     1131              
- Misses          603      612       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@alexmerlin alexmerlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a mixture of the two solutions (2.1 and 2.2) that I recommended.
The point of 2.2 is to have a single EnumType class that can be reused across all entities.
My recommendations:

  • create a new directory inside src/App/src, call it Doctrine or Types
  • refactor src/Admin/src/Entity/EnumAdminStatus.php by moving it to that new directory and calling it EnumType
  • register EnumType inside config/autoload/doctrine.global.php as before
  • adapt Admin entity by setting the status property's type to EnumType::NAME

Note:
Once you run the migration and the fixture, executing the diff command will throw an error, complaining that in EnumType::getSQLDeclaration the key values does not exist (neither would default, but that's a coincidence that it exists in both the type definition and the database table). This happens because executing the diff command will compare the already existing status column with the definition found in the entity. It is the definition coming from the database that does not have the values key.
You need to dig further in order to find out how to fix this issue.

@kakapiciu kakapiciu closed this Jan 22, 2024
@arhimede
Copy link
Member

Let's keep this open until we decide what to do with it

@arhimede arhimede reopened this Jan 22, 2024
@arhimede arhimede added the wip Work in progress label Feb 12, 2024
@arhimede arhimede marked this pull request as draft May 23, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wip Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants