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

initial commit #37

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

Conversation

padmasreegade
Copy link

draft version

@padmasreegade padmasreegade marked this pull request as draft December 16, 2024 18:45
Copy link
Owner

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

Thanks, @padmasreegade, this looks like it's off to a strong start. See below for a few minor suggestions.

*
* @param array $data Key-value pairs representing entity properties.
*/
public function exchangeArray(array $data): void;
Copy link
Owner

Choose a reason for hiding this comment

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

I would actually make this a separate interface, like VuFind\Db\Entity\ExchangeArrayInterface and then you could implement it via VuFind\Db\Entity\ExchangeArrayTrait. Then UserEntityInterface could extend ExchangeArrayInterface. This way, we could "mix in" this function to other entities as needed, but we keep the session serialization functionality distinct from all of the other more user-specific functionality.

@@ -228,7 +254,7 @@ public function updateUserEmail(
*/
public function addUserDataToSession(UserEntityInterface $user): void
{
if ($user instanceof UserRow) {
if ($user) {
Copy link
Owner

Choose a reason for hiding this comment

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

I think you can completely get rid of the if/else here, since $user will never be false.

return $this->getDbTable('User')->createRow();
$dql = 'SELECT u '
. 'FROM ' . $this->getEntityClass(UserEntityInterface::class) . ' u '
. 'WHERE u.password != \'\' '
Copy link
Owner

Choose a reason for hiding this comment

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

This might be a little easier to read:

Suggested change
. 'WHERE u.password != \'\' '
. "WHERE u.password != '' "

@demiankatz
Copy link
Owner

The other challenging thing that you're going to run into, though, is in \VuFind\Auth\Manager, which is currently designed to convert Doctrine entities into Laminas rows. It does this because the authentication system requires objects that implement \LmcRbacMvc\Identity\IdentityInterface, and currently, the entity objects do not, but the Laminas rows do.

The easiest short-term solution would be to implement \LmcRbacMvc\Identity\IdentityInterface in the User entity. I think it might be a better idea in the long run to separate these things out, so the identity is perhaps a wrapper around the entity, or something like that -- but we can worry about making it tidier after we have the basic functionality working. :-)

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.

2 participants