Skip to content

Commit

Permalink
Merge pull request #8 from GrandLTU/master
Browse files Browse the repository at this point in the history
Fix issue with load order and remove duplicated resource.
  • Loading branch information
tadcka authored Apr 9, 2019
2 parents 94ff73f + d7127c4 commit 12f2dc1
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 118 deletions.
9 changes: 5 additions & 4 deletions src/Command/SetupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function setupAdministratorUser(InputInterface $input, OutputInterface $

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

$outputStyle->writeln('<info>Administrator account successfully registered.</info>');
$outputStyle->newLine();
}
Expand All @@ -123,7 +123,7 @@ private function configureNewUser(AdminUserInterface $user, InputInterface $inpu
{
if ($input->getOption('no-interaction')) {
Assert::null($this->userRepository->findOneByEmail(self::DEFAULT_USER_EMAIL));

$user->setEmail(self::DEFAULT_USER_EMAIL);
$user->setPlainPassword(self::DEFAULT_USER_PASSWORD);

Expand All @@ -136,7 +136,7 @@ private function configureNewUser(AdminUserInterface $user, InputInterface $inpu
$question = $this->createEmailQuestion($output);
$email = $questionHelper->ask($input, $output, $question);
$exists = null !== $this->userRepository->findOneByEmail($email);

if ($exists) {
$output->writeln('<error>E-Mail is already in use!</error>');
}
Expand Down Expand Up @@ -185,7 +185,7 @@ private function getAdministratorPassword(InputInterface $input, OutputInterface
$confirmPasswordQuestion = $this->createPasswordQuestion('Confirm password:', $validator);
$password = $questionHelper->ask($input, $output, $passwordQuestion);
$repeatedPassword = $questionHelper->ask($input, $output, $confirmPasswordQuestion);

if ($repeatedPassword !== $password) {
$output->writeln('<error>Passwords do not match!</error>');
}
Expand All @@ -211,6 +211,7 @@ private function getPasswordQuestionValidator(OutputInterface $output)
return $value;
};
}

/**
* @param string $message
* @param \Closure $validator
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DashboardController

/**
* DashboardController constructor.
*
*
* @param EngineInterface $templating
*/
public function __construct(EngineInterface $templating)
Expand Down
68 changes: 0 additions & 68 deletions src/DependencyInjection/Configuration.php

This file was deleted.

13 changes: 4 additions & 9 deletions src/DependencyInjection/PlatformAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@

namespace Platform\Bundle\AdminBundle\DependencyInjection;

use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader;

class PlatformAdminExtension extends AbstractResourceExtension
class PlatformAdminExtension extends Extension
{
/**
* {@inheritdoc}
*/
public function load(array $config, ContainerBuilder $container)
public function load(array $config, ContainerBuilder $container): void
{
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));

$this->registerResources('admin_platform', $config['driver'], $config['resources'], $container);

$loader->load('services.xml');

$container->setParameter('admin_platform.driver', $config['driver']);
}
}
2 changes: 1 addition & 1 deletion src/Menu/MainMenuBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private function addConfigurationSubMenu(ItemInterface $menu)
;

$configuration
->addChild('admin_users', ['route' => 'admin_platform_admin_admin_user_index'])
->addChild('admin_users', ['route' => 'sylius_admin_admin_user_index'])
->setLabel('admin_platform.menu.main.configuration.admin_users')
->setLabelAttribute('icon', 'lock')
;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/AdminUserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function setLastName(?string $lastName): void;
* @return string
*/
public function getLocaleCode(): ?string;

/**
* @param string $code
*/
Expand Down
22 changes: 2 additions & 20 deletions src/PlatformAdminBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,8 @@

namespace Platform\Bundle\AdminBundle;

use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class PlatformAdminBundle extends AbstractResourceBundle
class PlatformAdminBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getSupportedDrivers(): array
{
return [
SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
];
}

/**
* {@inheritdoc}
*/
protected function getModelNamespace(): ?string
{
return 'Platform\Bundle\AdminBundle\Model';
}
}
1 change: 0 additions & 1 deletion src/Resources/config/app/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
imports:
- { resource: "@PlatformAdminBundle/Resources/config/app/sylius/grid.yml" }
- { resource: "@PlatformAdminBundle/Resources/config/app/sylius/locale.yml" }
- { resource: "@PlatformAdminBundle/Resources/config/app/sylius/resource.yml" }
- { resource: "@PlatformAdminBundle/Resources/config/app/sylius/user.yml" }
12 changes: 12 additions & 0 deletions src/Resources/config/app/doctrine_driver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
parameters:
admin_platform.driver: doctrine/orm

doctrine:
orm:
mappings:
admin_platform:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/vendor/admin-platform/admin-bundle/src/Resources/config/doctrine/model'
prefix: 'Platform\Bundle\AdminBundle\Model'
alias: PlatformAdminBundle
2 changes: 0 additions & 2 deletions src/Resources/config/app/sylius/grid.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
sylius_grid:
drivers:
- "%admin_platform.driver%"
templates:
action:
default: "@SyliusUi/Grid/Action/default.html.twig"
Expand Down
3 changes: 0 additions & 3 deletions src/Resources/config/app/sylius/resource.yml

This file was deleted.

2 changes: 2 additions & 0 deletions src/Resources/config/app/sylius/user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ sylius_user:
user:
classes:
model: Platform\Bundle\AdminBundle\Model\AdminUser
controller: Sylius\Bundle\ResourceBundle\Controller\ResourceController
repository: Sylius\Bundle\UserBundle\Doctrine\ORM\UserRepository
factory: Sylius\Component\Resource\Factory\Factory
form: Platform\Bundle\AdminBundle\Form\Type\AdminUserType
admin_oauth:
user:
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/doctrine/model/AdminUser.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

</mapped-superclass>

</doctrine-mapping>
</doctrine-mapping>
4 changes: 2 additions & 2 deletions src/Resources/config/grids/admin_user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ sylius_grid:
grids:
admin_platform_admin_user:
driver:
name: doctrine/orm
name: '%admin_platform.driver%'
options:
class: "%admin_platform.model.admin_user.class%"
class: "%sylius.model.admin_user.class%"
sorting:
createdAt: desc
fields:
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/grids/locale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sylius_grid:
grids:
admin_platform_locale:
driver:
name: doctrine/orm
name: '%admin_platform.driver%'
options:
class: "%sylius.model.locale.class%"
sorting:
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/routing/admin_user.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
admin_platform_admin_user:
resource: |
alias: admin_platform.admin_user
alias: sylius.admin_user
section: admin
path: users
templates: PlatformAdminBundle:Crud
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services/form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<services>

<service id="admin_platform.form.type.admin_user" class="Platform\Bundle\AdminBundle\Form\Type\AdminUserType">
<argument>%admin_platform.model.admin_user.class%</argument>
<argument>%sylius.model.admin_user.class%</argument>
<argument>%admin_platform.form.type.admin_user.validation_groups%</argument>
<tag name="form.type" />
</service>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/_security.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ app.user.firstName|default(app.user.email) }}
<i class="dropdown icon"></i>
<div class="menu">
<a href="{{ path('admin_platform_admin_admin_user_update', {'id': app.user.id}) }}" class="item">
<a href="{{ path('sylius_admin_admin_user_update', {'id': app.user.id}) }}" class="item">
<i class="user icon"></i>
{{ 'sylius.ui.my_account'|trans }}
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/Extension/CurrencyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function getFilters()

/**
* @param string $code
*
*
* @return null|string
*/
public function convertCurrencyCodeToSymbol($code)
Expand Down

0 comments on commit 12f2dc1

Please sign in to comment.