#6503: Generated add/edit views through the console should not be controller
dependent
----------------------------------------------------+-----------------------
    Reporter:  galette                              |          Type:  
Enhancement
      Status:  new                                  |      Priority:  Low       
 
   Milestone:  1.3.x.x                              |     Component:  Console   
 
     Version:  1.2 Final                            |      Severity:  Minor     
 
    Keywords:  console scaffolding views generated  |   Php_version:  PHP 5     
 
Cake_version:                                       |  
----------------------------------------------------+-----------------------
 == What I did: ==
 I baked basic add/edit/view views from the console for a new model, then I
 copied both controller and views to a new set of controller/views in order
 to build other screens of my application. I renamed the controller
 file,class and specified through 'uses' the model it should use.

 == What I expected to happen: ==
 I expected the new controller perfectly working, with links in views
 pointing to the current (new) controller.

 == Why it didn't meet my expectations ==
 The form is still pointing to the controller initially generated through
 console because the Form helper point to the generated controller based on
 Model name and not to the current controller
 $form->create('{$modelClass}');

 == Possible Fix ==
 Specify to the generated view to use current controller.
 In branches/1.2.x.x/cake/console/libs/templates/views/form.ctp , pass a
 second url parameter to the form controller :
 Replacing
 {{{
         <?php echo "<?php echo \$form->create('{$modelClass}');?>\n";?>
 }}}
 By something like
 {{{
         <?php echo "<?php echo \$form->create('{$modelClass}',
 array('url'=> array('controller' => \$this->params['controller'],
 'action'=>{$action})));?>\n";?>
 }}}

 This will simplify the copy of a set of controller/views.

 == Side effect ==
 This will introduce code sample of how pointing specific controller/view
 from a form that may be appropriate for beginners even if it's written in
 documentation

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6503>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to