From 1c5bc4b1d0de45fd522b09f2cb0cdcff59810500 Mon Sep 17 00:00:00 2001 From: bermiferrer Date: Wed, 16 Apr 2008 00:20:06 +0000 Subject: [PATCH] Scaffold generator when using plural controller names created plural helpers, while the Action Controller expects singular helper names even on singularized controllers. We will change this incongruence on the scaffold side to avoid problems on existing applications. git-svn-id: http://svn.akelos.org/trunk@566 a2fa5c27-f921-0410-a72c-bf682d381be0 --- lib/utils/generators/scaffold/scaffold_generator.php | 3 ++- lib/utils/generators/scaffold/sintags_templates/helper.php | 2 +- lib/utils/generators/scaffold/templates/helper.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/utils/generators/scaffold/scaffold_generator.php b/lib/utils/generators/scaffold/scaffold_generator.php index 2e81ae0..0c1189f 100644 --- a/lib/utils/generators/scaffold/scaffold_generator.php +++ b/lib/utils/generators/scaffold/scaffold_generator.php @@ -30,7 +30,8 @@ class ScaffoldGenerator extends AkelosGenerator $this->controller_class_name = str_replace(array('/','::'),'_', $this->controller_name.'Controller'); $this->controller_name = AkInflector::demodulize($this->controller_name); $this->controller_human_name = AkInflector::humanize($this->controller_name); - $this->helper_var_name = '$'.AkInflector::underscore($this->controller_name).'_helper'; + $this->helper_name = (AkInflector::is_plural($this->controller_name)?AkInflector::singularize($this->controller_name):$this->controller_name).'Helper'; + $this->helper_var_name = '$'.AkInflector::underscore($this->helper_name); $this->singular_name = AkInflector::underscore($this->model_name); $this->plural_name = AkInflector::pluralize($this->singular_name); diff --git a/lib/utils/generators/scaffold/sintags_templates/helper.php b/lib/utils/generators/scaffold/sintags_templates/helper.php index acb3ccb..d03e26a 100644 --- a/lib/utils/generators/scaffold/sintags_templates/helper.php +++ b/lib/utils/generators/scaffold/sintags_templates/helper.php @@ -1,7 +1,7 @@ -class Helper extends AkActionViewHelper +class extends AkActionViewHelper { function cancel($url = array('action' => 'listing')) { diff --git a/lib/utils/generators/scaffold/templates/helper.php b/lib/utils/generators/scaffold/templates/helper.php index acb3ccb..d03e26a 100644 --- a/lib/utils/generators/scaffold/templates/helper.php +++ b/lib/utils/generators/scaffold/templates/helper.php @@ -1,7 +1,7 @@ -class Helper extends AkActionViewHelper +class extends AkActionViewHelper { function cancel($url = array('action' => 'listing')) { -- 2.11.4.GIT