Skip to content

Commit

Permalink
Applied fixes from StyleCI (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI authored and soullivaneuh committed May 14, 2016
1 parent e25f44a commit dc2fd77
Show file tree
Hide file tree
Showing 72 changed files with 340 additions and 351 deletions.
2 changes: 1 addition & 1 deletion Admin/Document/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
2 changes: 1 addition & 1 deletion Admin/Document/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
2 changes: 1 addition & 1 deletion Admin/Entity/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
2 changes: 1 addition & 1 deletion Admin/Entity/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
2 changes: 1 addition & 1 deletion Admin/Model/GroupAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
60 changes: 30 additions & 30 deletions Admin/Model/UserAdmin.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -53,6 +53,31 @@ public function getExportFields()
});
}

/**
* {@inheritdoc}
*/
public function preUpdate($user)
{
$this->getUserManager()->updateCanonicalFields($user);
$this->getUserManager()->updatePassword($user);
}

/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}

/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}

/**
* {@inheritdoc}
*/
Expand Down Expand Up @@ -160,17 +185,17 @@ protected function configureFormFields(FormMapper $formMapper)
->end()
->with('Profile')
->add('dateOfBirth', 'sonata_type_date_picker', array(
'years' => range(1900, $now->format('Y')),
'years' => range(1900, $now->format('Y')),
'dp_min_date' => '1-1-1900',
'dp_max_date' => $now->format('c'),
'required' => false,
'required' => false,
))
->add('firstname', null, array('required' => false))
->add('lastname', null, array('required' => false))
->add('website', 'url', array('required' => false))
->add('biography', 'text', array('required' => false))
->add('gender', 'sonata_user_gender', array(
'required' => true,
'required' => true,
'translation_domain' => $this->getTranslationDomain(),
))
->add('locale', 'locale', array('required' => false))
Expand Down Expand Up @@ -202,7 +227,7 @@ protected function configureFormFields(FormMapper $formMapper)
->end()
->with('Roles')
->add('realRoles', 'sonata_security_roles', array(
'label' => 'form.label_roles',
'label' => 'form.label_roles',
'expanded' => true,
'multiple' => true,
'required' => false,
Expand All @@ -215,29 +240,4 @@ protected function configureFormFields(FormMapper $formMapper)
->end()
;
}

/**
* {@inheritdoc}
*/
public function preUpdate($user)
{
$this->getUserManager()->updateCanonicalFields($user);
$this->getUserManager()->updatePassword($user);
}

/**
* @param UserManagerInterface $userManager
*/
public function setUserManager(UserManagerInterface $userManager)
{
$this->userManager = $userManager;
}

/**
* @return UserManagerInterface
*/
public function getUserManager()
{
return $this->userManager;
}
}
8 changes: 4 additions & 4 deletions Block/AccountBlockService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -64,8 +64,8 @@ public function execute(BlockContextInterface $blockContext, Response $response
}

return $this->renderPrivateResponse($blockContext->getTemplate(), array(
'user' => $user,
'block' => $blockContext->getBlock(),
'user' => $user,
'block' => $blockContext->getBlock(),
'context' => $blockContext,
));
}
Expand All @@ -77,7 +77,7 @@ public function configureSettings(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'template' => 'SonataUserBundle:Block:account.html.twig',
'ttl' => 0,
'ttl' => 0,
));
}

Expand Down
4 changes: 2 additions & 2 deletions Block/Breadcrumb/BaseUserProfileBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -29,7 +29,7 @@ protected function getRootMenu(BlockContextInterface $blockContext)
$menu = parent::getRootMenu($blockContext);

$menu->addChild('sonata_user_profile_breadcrumb_index', array(
'route' => 'sonata_user_profile_show',
'route' => 'sonata_user_profile_show',
'extras' => array('translation_domain' => 'SonataUserBundle'),
));

Expand Down
2 changes: 1 addition & 1 deletion Block/Breadcrumb/UserIndexBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
4 changes: 2 additions & 2 deletions Block/Breadcrumb/UserProfileBreadcrumbBlockService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -36,7 +36,7 @@ protected function getMenu(BlockContextInterface $blockContext)
$menu = $this->getRootMenu($blockContext);

$menu->addChild('sonata_user_profile_breadcrumb_edit', array(
'route' => 'sonata_user_profile_edit',
'route' => 'sonata_user_profile_edit',
'extras' => array('translation_domain' => 'SonataUserBundle'),
));

Expand Down
6 changes: 3 additions & 3 deletions Block/ProfileMenuBlockService.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -62,7 +62,7 @@ public function configureSettings(OptionsResolver $resolver)
parent::configureSettings($resolver);

$resolver->setDefaults(array(
'cache_policy' => 'private',
'cache_policy' => 'private',
'menu_template' => 'SonataBlockBundle:Block:block_side_menu_template.html.twig',
));
}
Expand All @@ -80,7 +80,7 @@ protected function getMenu(BlockContextInterface $blockContext)
$menu = $this->menuBuilder->createProfileMenu(
array(
'childrenAttributes' => array('class' => $settings['menu_class']),
'attributes' => array('class' => $settings['children_class']),
'attributes' => array('class' => $settings['children_class']),
)
);

Expand Down
2 changes: 1 addition & 1 deletion Command/TwoStepVerificationCommand.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down
22 changes: 11 additions & 11 deletions Controller/AdminResettingController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the Sonata package.
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
Expand Down Expand Up @@ -33,7 +33,7 @@ public function requestAction()

return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/request.html.'.$this->getEngine(), array(
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
));
}

Expand All @@ -50,15 +50,15 @@ public function sendEmailAction()
if (null === $user) {
return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/request.html.'.$this->getEngine(), array(
'invalid_username' => $username,
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
));
}

if ($user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/passwordAlreadyRequested.html.'.$this->getEngine(), array(
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
));
}

Expand Down Expand Up @@ -91,9 +91,9 @@ public function checkEmailAction()
}

return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/checkEmail.html.'.$this->getEngine(), array(
'email' => $email,
'email' => $email,
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
));
}

Expand Down Expand Up @@ -129,10 +129,10 @@ public function resetAction($token)
}

return $this->container->get('templating')->renderResponse('SonataUserBundle:Admin:Security/Resetting/reset.html.'.$this->getEngine(), array(
'token' => $token,
'form' => $form->createView(),
'token' => $token,
'form' => $form->createView(),
'base_template' => $this->container->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
'admin_pool' => $this->container->get('sonata.admin.pool'),
));
}
}
32 changes: 16 additions & 16 deletions Controller/AdminSecurityController.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/*
* This file is part of the FOSUserBundle package.
* This file is part of the Sonata Project package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
Expand Down Expand Up @@ -82,14 +82,24 @@ public function loginAction(Request $request = null)

return $this->render('SonataUserBundle:Admin:Security/login.html.'.$this->container->getParameter('fos_user.template.engine'), array(
'last_username' => $lastUsername,
'error' => $error,
'csrf_token' => $csrfToken,
'error' => $error,
'csrf_token' => $csrfToken,
'base_template' => $this->get('sonata.admin.pool')->getTemplate('layout'),
'admin_pool' => $this->get('sonata.admin.pool'),
'reset_route' => $resetRoute, // TODO: Deprecated in 2.3, to be removed in 3.0
'admin_pool' => $this->get('sonata.admin.pool'),
'reset_route' => $resetRoute, // TODO: Deprecated in 2.3, to be removed in 3.0
));
}

public function checkAction()
{
throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
}

public function logoutAction()
{
throw new \RuntimeException('You must activate the logout in your security firewall configuration.');
}

/**
* Renders the login template with the given parameters. Overwrite this function in
* an extended controller to provide additional data for the login template.
Expand All @@ -104,14 +114,4 @@ protected function renderLogin(array $data)

return $this->render($template, $data);
}

public function checkAction()
{
throw new \RuntimeException('You must configure the check path to be handled by the firewall using form_login in your security firewall configuration.');
}

public function logoutAction()
{
throw new \RuntimeException('You must activate the logout in your security firewall configuration.');
}
}
Loading

0 comments on commit dc2fd77

Please sign in to comment.