Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AppBundle/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$user->setPassword($encodedPassword);

$this->entityManager->persist($user);
$this->entityManager->flush($user);
$this->entityManager->flush();

$output->writeln('');
$output->writeln(sprintf('[OK] %s was successfully created: %s (%s)', $isAdmin ? 'Administrator user' : 'User', $user->getUsername(), $user->getEmail()));
Expand Down
3 changes: 2 additions & 1 deletion src/AppBundle/Command/DeleteUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

namespace AppBundle\Command;

use AppBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
use Doctrine\Common\Persistence\ObjectManager;
Expand Down Expand Up @@ -109,6 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->usernameValidator($username);

$repository = $this->entityManager->getRepository('AppBundle:User');
/** @var User $user */
Copy link
Contributor

Choose a reason for hiding this comment

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

@yceruto, I think it's better to use a FQCN here.

Copy link
Member Author

Choose a reason for hiding this comment

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

@voronkovich why it's better to use a FQCN here? please, could you explain a little more.

Copy link
Contributor

Choose a reason for hiding this comment

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

@yceruto, using FQCN doesn't require to import User class.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, fixed! thanks @voronkovich

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed by @xabbuh comment

$user = $repository->findOneByUsername($username);

if (null === $user) {
Expand Down
4 changes: 3 additions & 1 deletion src/AppBundle/Command/ListUsersCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace AppBundle\Command;

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

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

Expand Down
1 change: 0 additions & 1 deletion src/AppBundle/Repository/PostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace AppBundle\Repository;

use Doctrine\ORM\EntityRepository;
use AppBundle\Entity\Post;

/**
* This custom Doctrine repository contains some methods which are useful when
Expand Down
1 change: 1 addition & 0 deletions src/AppBundle/Twig/AppExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public function getLocales()
{
$localeCodes = explode('|', $this->locales);

$locales = array();
foreach ($localeCodes as $localeCode) {
$locales[] = array('code' => $localeCode, 'name' => Intl::getLocaleBundle()->getLocaleName($localeCode, $localeCode));
}
Expand Down