Skip to content

Commit 36a93fd

Browse files
committed
minor #238 Fixing details (yceruto)
This PR was squashed before being merged into the master branch (closes #238). Discussion ---------- Fixing details * Fixing imports (unused or missing). * Adding type hinting. * Fixed variable definition. Commits ------- 6702b63 Fixing details
2 parents 4dd93aa + 6702b63 commit 36a93fd

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

src/AppBundle/Command/AddUserCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
195195
$user->setPassword($encodedPassword);
196196

197197
$this->entityManager->persist($user);
198-
$this->entityManager->flush($user);
198+
$this->entityManager->flush();
199199

200200
$output->writeln('');
201201
$output->writeln(sprintf('[OK] %s was successfully created: %s (%s)', $isAdmin ? 'Administrator user' : 'User', $user->getUsername(), $user->getEmail()));

src/AppBundle/Command/DeleteUserCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
namespace AppBundle\Command;
1313

14+
use AppBundle\Entity\User;
1415
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1516
use Symfony\Component\Console\Input\InputArgument;
1617
use Symfony\Component\Console\Input\InputInterface;
17-
use Symfony\Component\Console\Input\InputOption;
1818
use Symfony\Component\Console\Output\OutputInterface;
1919
use Symfony\Component\Console\Question\Question;
2020
use Doctrine\Common\Persistence\ObjectManager;
@@ -109,6 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
109109
$this->usernameValidator($username);
110110

111111
$repository = $this->entityManager->getRepository('AppBundle:User');
112+
/** @var User $user */
112113
$user = $repository->findOneByUsername($username);
113114

114115
if (null === $user) {

src/AppBundle/Command/ListUsersCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace AppBundle\Command;
1313

14+
use AppBundle\Entity\User;
15+
use Doctrine\Common\Persistence\ObjectManager;
1416
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1517
use Symfony\Component\Console\Helper\Table;
1618
use Symfony\Component\Console\Input\InputInterface;
@@ -88,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8890
$users = $this->entityManager->getRepository('AppBundle:User')->findBy(array(), array('id' => 'DESC'), $maxResults);
8991

9092
// Doctrine query returns an array of objects and we need an array of plain arrays
91-
$usersAsPlainArrays = array_map(function ($user) {
93+
$usersAsPlainArrays = array_map(function (User $user) {
9294
return array($user->getId(), $user->getUsername(), $user->getEmail(), implode(', ', $user->getRoles()));
9395
}, $users);
9496

src/AppBundle/Repository/PostRepository.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace AppBundle\Repository;
1313

1414
use Doctrine\ORM\EntityRepository;
15-
use AppBundle\Entity\Post;
1615

1716
/**
1817
* This custom Doctrine repository contains some methods which are useful when

src/AppBundle/Twig/AppExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function getLocales()
8787
{
8888
$localeCodes = explode('|', $this->locales);
8989

90+
$locales = array();
9091
foreach ($localeCodes as $localeCode) {
9192
$locales[] = array('code' => $localeCode, 'name' => Intl::getLocaleBundle()->getLocaleName($localeCode, $localeCode));
9293
}

0 commit comments

Comments
 (0)