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

[FAU-443, FAU-444] Make “German language skills for international students” taxonomy hierarchical #20

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

zhyian
Copy link
Collaborator

@zhyian zhyian commented Dec 18, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature.

What is the current behavior? (You can also link to an open issue here)
https://inpsyde.atlassian.net/browse/FAU-443
https://inpsyde.atlassian.net/browse/FAU-444

Discussion: https://inpsyde.slack.com/archives/C045KFJ9MB5/p1734520808952019

What is the new behavior (if this is a feature change)?

  • German language skills for international students taxonomy is hierarchical
  • MultilingualLink has been extended with a parent property to enable proper synchronization of both child and parent terms to consuming websites

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No

Other information:
Related PR that incorporates the use of parent property for synchronization to consuming websites: RRZE-Webteam/FAU-Studium-Embed#49

@zhyian zhyian marked this pull request as ready for review December 18, 2024 15:18
@zhyian zhyian requested review from shvlv, amiut and o-samaras December 18, 2024 15:18
Copy link
Collaborator

@o-samaras o-samaras left a comment

Choose a reason for hiding this comment

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

Code-wise LGTM. Thanks

Copy link
Collaborator

@amiut amiut left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for taking care of it

@zhyian zhyian marked this pull request as draft December 23, 2024 08:59
Copy link
Collaborator

@shvlv shvlv left a comment

Choose a reason for hiding this comment

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

LGTM!

src/Infrastructure/Repository/BilingualRepository.php Outdated Show resolved Hide resolved
Copy link
Collaborator

@o-samaras o-samaras left a comment

Choose a reason for hiding this comment

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

Thank you for working on that!

return new self(
$data[MultilingualLink::NAME],
$data[MultilingualLink::LINK_TEXT],
$data[MultilingualLink::LINK_URL],
!empty($parentData) ? self::fromArray($parentData) : null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is wrong. If $parentData is not empty, then fromArray is called again but this time you 're passing a Link object instead of an array. Apart from the type error this (calling fromArray() again) doesn't make sense to me in general, but I may be overlooking something here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing this out! I believe this is correct since we’re passing an array as defined by the @psalm-type

/**
* @psalm-type Link = array{
* name: string,
* link_text: string,
* link_url: string,
* }
* @psalm-type LinkType = Link & array{parent?: Link|null}
*/

return new self(
$data[self::ID],
MultilingualString::fromArray($data[self::NAME]),
MultilingualString::fromArray($data[self::LINK_TEXT]),
MultilingualString::fromArray($data[self::LINK_URL]),
!empty($parentData) ? self::fromArray($parentData) : null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The same:

/**
* @psalm-import-type MultilingualStringType from MultilingualString
* @psalm-type MultilingualLink = array{
* id: string,
* name: MultilingualStringType,
* link_text: MultilingualStringType,
* link_url: MultilingualStringType
* }
* @psalm-type MultilingualLinkType = MultilingualLink & array{parent?: MultilingualLink|null}
*/

src/Infrastructure/Repository/BilingualRepository.php Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants