Skip to content

Conversation

@arfaram
Copy link

@arfaram arfaram commented May 30, 2018

setCurrentUser() is deprecated since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() like indicated in :
https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/SignalSlot/Repository.php#L202

…urrentUserReference()

setCurrentUser() since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() like indicated in :
https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Publish/Core/SignalSlot/Repository.php#L202
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

Good one!
Requires improvement:

$contentTypeService = $repository->getContentTypeService();

$repository->setCurrentUser( $repository->getUserService()->loadUser( 14 ) );
$this->getRepository()->getPermissionResolver()->setCurrentUserReference( $this->getRepository()->getUserService()->loadUser( 14 ) );
Copy link
Member

Choose a reason for hiding this comment

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

  1. You can use $repository instead of $this-getRepository().
  2. Good chance to fix bad practice relying on hardcoded id. Look at e.g this command to see newest best practice. Ideally this entire block setting user context should be moved to initialize as in the mentioned command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants