Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AllBundles] Use built-in getParameter #1342

Merged
merged 1 commit into from
Nov 2, 2016
Merged
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/Kunstmaan/AdminBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class DefaultController extends Controller
public function indexAction()
{
if ($this->container->hasParameter("kunstmaan_admin.dashboard_route")) {
return $this->redirect($this->generateUrl($this->container->getParameter("kunstmaan_admin.dashboard_route")));
return $this->redirect($this->generateUrl($this->getParameter("kunstmaan_admin.dashboard_route")));
}

/* @var DashboardConfiguration $dashboardConfiguration */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function widgetAction(Request $request)

// if token not set
if (!$configHelper->tokenIsSet()) {
if ($this->container->getParameter('google.api.client_id') != '' && $this->container->getParameter('google.api.client_secret') != '' && $this->container->getParameter('google.api.dev_key') != '' ) {
if ($this->getParameter('google.api.client_id') != '' && $this->getParameter('google.api.client_secret') != '' && $this->getParameter('google.api.dev_key') != '' ) {
$params['authUrl'] = $configHelper->getAuthUrl($params['redirect_uri']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class LanguageChooserController extends Controller
*/
public function indexAction(Request $request)
{
$enableAutodetect = $this->container->getParameter('kunstmaan_language_chooser.autodetectlanguage');
$enableSplashpage = $this->container->getParameter('kunstmaan_language_chooser.showlanguagechooser');
$enableAutodetect = $this->getParameter('kunstmaan_language_chooser.autodetectlanguage');
$enableSplashpage = $this->getParameter('kunstmaan_language_chooser.showlanguagechooser');

$defaultLocale = $this->container->getParameter('defaultlocale');
$defaultLocale = $this->getParameter('defaultlocale');

if ($enableAutodetect) {
$localeGuesserManager = $this->get('lunetics_locale.guesser_manager');
Expand All @@ -44,7 +44,7 @@ public function indexAction(Request $request)
}

if ($enableSplashpage) {
$viewPath = $this->container->getParameter('kunstmaan_language_chooser.languagechoosertemplate');
$viewPath = $this->getParameter('kunstmaan_language_chooser.languagechoosertemplate');

return $this->render($viewPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ public function editAction(Request $request, $id, $subaction)
//Check the version timeout and make a new nodeversion if the timeout is passed
$thresholdDate = date(
"Y-m-d H:i:s",
time() - $this->container->getParameter(
time() - $this->getParameter(
"kunstmaan_node.version_timeout"
)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/NodeBundle/Controller/WidgetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function getTemplateParameters(Request $request)
}

// When the media bundle is available, we show a link in the header to the media chooser
$allBundles = $this->container->getParameter('kernel.bundles');
$allBundles = $this->getParameter('kernel.bundles');
$mediaChooserLink = null;

if (array_key_exists('KunstmaanMediaBundle', $allBundles)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function robotsSettingsAction(Request $request)
$em = $this->getDoctrine()->getManager();
$repo = $this->getDoctrine()->getRepository("KunstmaanSeoBundle:Robots");
$robot = $repo->findOneBy(array());
$default = $this->container->getParameter('robots_default');
$default = $this->getParameter('robots_default');
$isSaved = true;

if (!$robot) {
Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/SeoBundle/Controller/RobotsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RobotsController extends Controller
public function indexAction(Request $request)
{
$entity = $this->getDoctrine()->getRepository('KunstmaanSeoBundle:Robots')->findOneBy(array());
$robots = $this->container->getParameter('robots_default');
$robots = $this->getParameter('robots_default');

if ($entity && $entity->getRobotsTxt()) {
$robots = $entity->getRobotsTxt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public function importAction()
$importCommand = new ImportCommand();
$importCommand
->setForce(false)
->setDefaultBundle($this->container->getParameter('kuma_translator.default_bundle'))
->setBundles($this->container->getParameter('kuma_translator.bundles'))
->setDefaultBundle($this->getParameter('kuma_translator.default_bundle'))
->setBundles($this->getParameter('kuma_translator.bundles'))
->setGlobals(true);

$this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand);
Expand All @@ -49,8 +49,8 @@ public function importForcedAction()
$importCommand = new ImportCommand();
$importCommand
->setForce(true)
->setDefaultBundle($this->container->getParameter('kuma_translator.default_bundle'))
->setBundles($this->container->getParameter('kuma_translator.bundles'))
->setDefaultBundle($this->getParameter('kuma_translator.default_bundle'))
->setBundles($this->getParameter('kuma_translator.bundles'))
->setGlobals(false);

$this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function indexAction(Request $request)
$adminList->bindRequest($request);

$cacheFresh = $this->get('kunstmaan_translator.service.translator.cache_validator')->isCacheFresh();
$debugMode = $this->container->getParameter('kuma_translator.debug') === true;
$debugMode = $this->getParameter('kuma_translator.debug') === true;

if (!$cacheFresh && !$debugMode) {
$noticeText = $this->get('translator')->trans('settings.translator.not_live_warning');
Expand Down Expand Up @@ -82,7 +82,7 @@ public function addAction(Request $request, $keyword = '', $domain = '', $locale
$translator = $this->get('translator');

$translation = new \Kunstmaan\TranslatorBundle\Model\Translation();
$locales = $this->container->getParameter('kuma_translator.managed_locales');
$locales = $this->getParameter('kuma_translator.managed_locales');
foreach ($locales as $locale) {
$translation->addText($locale, '');
}
Expand Down Expand Up @@ -150,7 +150,7 @@ public function editAction(Request $request, $id)
$translation = new \Kunstmaan\TranslatorBundle\Model\Translation();
$translation->setDomain($translations[0]->getDomain());
$translation->setKeyword($translations[0]->getKeyword());
$locales = $this->container->getParameter('kuma_translator.managed_locales');
$locales = $this->getParameter('kuma_translator.managed_locales');
foreach ($locales as $locale) {
$found = false;
foreach ($translations as $t) {
Expand Down Expand Up @@ -250,7 +250,7 @@ public function setAdminListConfigurator($adminListConfigurator)
*/
public function getAdminListConfigurator()
{
$locales = explode('|', $this->container->getParameter('requiredlocales'));
$locales = explode('|', $this->getParameter('requiredlocales'));

if (!isset($this->adminListConfigurator)) {
$this->adminListConfigurator = new TranslationAdminListConfigurator($this->getDoctrine()->getManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function listAction(Request $request)
$userObject = $this->getUserClassInstance();
$configuratorClassName = '';
if ($this->container->hasParameter('kunstmaan_user_management.user_admin_list_configurator.class')) {
$configuratorClassName = $this->container->getParameter(
$configuratorClassName = $this->getParameter(
'kunstmaan_user_management.user_admin_list_configurator.class'
);
}
Expand All @@ -71,7 +71,7 @@ public function listAction(Request $request)
*/
private function getUserClassInstance()
{
$userClassName = $this->container->getParameter('fos_user.model.user.class');
$userClassName = $this->getParameter('fos_user.model.user.class');

return new $userClassName();
}
Expand All @@ -93,7 +93,7 @@ public function addAction(Request $request)

$user = $this->getUserClassInstance();

$options = array('password_required' => true, 'langs' => $this->container->getParameter('kunstmaan_admin.admin_locales'), 'validation_groups' => array('Registration'), 'data_class' => get_class($user));
$options = array('password_required' => true, 'langs' => $this->getParameter('kunstmaan_admin.admin_locales'), 'validation_groups' => array('Registration'), 'data_class' => get_class($user));
$formTypeClassName = $user->getFormTypeClass();
$formType = new $formTypeClassName();

Expand Down Expand Up @@ -156,15 +156,15 @@ public function editAction(Request $request, $id)
$em = $this->getDoctrine()->getManager();

/** @var UserInterface $user */
$user = $em->getRepository($this->container->getParameter('fos_user.model.user.class'))->find($id);
$user = $em->getRepository($this->getParameter('fos_user.model.user.class'))->find($id);
if ($user === null) {
throw new NotFoundHttpException(sprintf('User with ID %s not found', $id));
}

$userEvent = new UserEvent($user, $request);
$this->container->get('event_dispatcher')->dispatch(UserEvents::USER_EDIT_INITIALIZE, $userEvent);

$options = array('password_required' => false, 'langs' => $this->container->getParameter('kunstmaan_admin.admin_locales'), 'data_class' => get_class($user));
$options = array('password_required' => false, 'langs' => $this->getParameter('kunstmaan_admin.admin_locales'), 'data_class' => get_class($user));
$formFqn = $user->getFormTypeClass();
$formType = new $formFqn();

Expand Down Expand Up @@ -238,7 +238,7 @@ public function deleteAction(Request $request, $id)
/* @var $em EntityManager */
$em = $this->getDoctrine()->getManager();
/* @var UserInterface $user */
$user = $em->getRepository($this->container->getParameter('fos_user.model.user.class'))->find($id);
$user = $em->getRepository($this->getParameter('fos_user.model.user.class'))->find($id);
if (!is_null($user)) {
$userEvent = new UserEvent($user, $request);
$this->container->get('event_dispatcher')->dispatch(UserEvents::USER_DELETE_INITIALIZE, $userEvent);
Expand Down