Skip to content

Conversation

dantleech
Copy link
Contributor

This PR contains 3 commits which fix some issues in the user/role commands

  • Handle the case where either a role or a user already exists
  • Handle the case where the requested role does not exist (non-interactive)
  • Indicate which roles are available in the Exception message (non-interactive)
  • Handle the case where no roles exist (interactive)
  • Added preUpdate and prePersist hooks to set the created + changed fields on the Role entity.

Tasks:

  • test coverage
  • gather feedback for my changes
  • added changelog line

Informations:

Q A
Tests pass? yes
Fixed tickets #683 ]
BC Breaks NO
Doc NO

- Show error message instead and exit with status 1
- Handle case where requested role does not exist
- Handle case where username already exists
@@ -43,13 +43,25 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$doctrine = $this->getContainer()->get('doctrine');
$em = $doctrine->getManager();
$now = new \Datetime();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled by Doctrine event hooks.

@dantleech dantleech force-pushed the feature/command_improvements branch from 7810b43 to 77decd9 Compare January 12, 2015 09:19
foreach ($query->getArrayResult() as $roleEntity) {
$roles[] = $roleEntity['name'];
}
$roleNames = $this->getRoleNames();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this to repository.

@dantleech dantleech force-pushed the feature/command_improvements branch from 77decd9 to 5dd2156 Compare January 12, 2015 09:21
@@ -28,5 +28,10 @@
</join-columns>
</many-to-one>

<lifecycle-callbacks>
<lifecycle-callback type="prePersist" method="beforeSave" />
Copy link
Member

Choose a reason for hiding this comment

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

@dantleech why call the method like event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updateTimestamps

@dantleech dantleech force-pushed the feature/command_improvements branch from 5dd2156 to 7d4d681 Compare January 12, 2015 10:29
wachterjohannes added a commit that referenced this pull request Jan 12, 2015
@wachterjohannes wachterjohannes merged commit 6a930a4 into develop Jan 12, 2015
@wachterjohannes wachterjohannes deleted the feature/command_improvements branch January 12, 2015 10:30
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