-
Notifications
You must be signed in to change notification settings - Fork 26
Upgrade to doctrine/dbal:4 #1872
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
base: upgrade-84
Are you sure you want to change the base?
Conversation
MKodde
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! We had a small discussion IRL where I questioned the current solution:
- Could you make a more 'generic' solution for the object and array types that you now added. This would need to include passing the type of the array items that are stored for additional type checking. And maybe passing a max length as some types have different requirements for that..
- Keep the current setup but add some additional (unit or integration) tests. I've found a couple of unit tests for two of the existing types
Question: are the types used in the existing functional tests? Or are they bypassed by the custom mock solution?
| * @var string[] | ||
| */ | ||
| #[ORM\Column(name: 'allowed_idp_entity_ids', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 6777215)] | ||
| #[ORM\Column(name: 'allowed_idp_entity_ids', type: 'json', length: 16777215, nullable: true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the (significant) length increase intentional?
I also see that the field became nullable, but that is now explicitly set for all of the updated columns. I'm assuming that was previously the default setting which now needs an explicit setting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johanib Note to self: Do we really want this? Better to avoid a migration and make specific types for the fields that use array, or copy the Array type into EB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error: Use SimpleArray, json is fundamentally different and requires a migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MKodde I checked the length with: #1861 (comment)
Its currently mediumtext on prod, so it should be 16777215. I htink 6777215 was a typo.
805c922 to
271256a
Compare
| * @var string[] | ||
| */ | ||
| #[ORM\Column(name: 'name_id_formats', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 65535)] | ||
| #[ORM\Column(name: 'name_id_formats', type: 'json', length: 65535)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error: Use SimpleArray, json is fundamentally different and requires a migration.
| * @var string[] | ||
| */ | ||
| #[ORM\Column(name: 'allowed_idp_entity_ids', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 6777215)] | ||
| #[ORM\Column(name: 'allowed_idp_entity_ids', type: 'json', length: 16777215, nullable: true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error: Use SimpleArray, json is fundamentally different and requires a migration.
271256a to
cb43e68
Compare
cb43e68 to
fdc995d
Compare
| engineblock_requested_attribute_array: OpenConext\EngineBlockBundle\Doctrine\Type\RequestedAttributeArrayType | ||
| engineblock_shib_md_scope_array: OpenConext\EngineBlockBundle\Doctrine\Type\ShibMdScopeArrayType | ||
| engineblock_attribute_release_policy: OpenConext\EngineBlockBundle\Doctrine\Type\AttributeReleasePolicyType | ||
| engineblock_simple_array: OpenConext\EngineBlockBundle\Doctrine\Type\SimpleArrayType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does doctrine not have a native simple array type??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.doctrine-project.org/projects/doctrine-dbal/en/4.4/reference/types.html#simple-array
Is this what you are looking for?
fdc995d to
84b50bb
Compare
Prior to this change, the DoctrineConnectionCheck from the monitor bundle was used instead of the check from EB. This became apparent as the doctrine/dbal broke the DoctrineConnectionHealthCheck from the Monitor bundle. See #1902
| engineblock_requested_attribute_array: OpenConext\EngineBlockBundle\Doctrine\Type\RequestedAttributeArrayType | ||
| engineblock_shib_md_scope_array: OpenConext\EngineBlockBundle\Doctrine\Type\ShibMdScopeArrayType | ||
| engineblock_attribute_release_policy: OpenConext\EngineBlockBundle\Doctrine\Type\AttributeReleasePolicyType | ||
| engineblock_simple_array: OpenConext\EngineBlockBundle\Doctrine\Type\SimpleArrayType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.doctrine-project.org/projects/doctrine-dbal/en/4.4/reference/types.html#simple-array
Is this what you are looking for?
| * @deprecated Will be removed in favour of using the Mdui value object, use the getter for this field instead | ||
| */ | ||
| #[ORM\Column(name: 'logo', type: \Doctrine\DBAL\Types\Types::OBJECT)] | ||
| #[ORM\Column(name: 'logo', type: 'engineblock_logo', nullable: true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe consider using a enum for the custom type. This will make it more save to use them without making mistakes. What do you think?
| * @var Organization | ||
| */ | ||
| #[ORM\Column(name: 'organization_nl_name', type: \Doctrine\DBAL\Types\Types::OBJECT, nullable: true, length: 65535)] | ||
| #[ORM\Column(name: 'organization_nl_name', type: 'engineblock_organization', nullable: true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As these are custom types for this project specific do we need the engineblock prefix?
| * @var string[] | ||
| */ | ||
| #[ORM\Column(name: 'name_id_formats', type: \Doctrine\DBAL\Types\Types::ARRAY, length: 65535)] | ||
| #[ORM\Column(name: 'name_id_formats', type: 'engineblock_simple_array', length: 65535)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the simple array from doctrine should a good case for this one
| } | ||
|
|
||
| /** | ||
| * @param Logo|null $value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that you have added a param for the value here but thats not consistent with the other custom types. Is this on purpose?
Needed for SF 6.4