#5566: Shells dont load plugin models right way
-------------------------------------+--------------------------------------
    Reporter:  AbhimanyuG            |          Type:  Bug    
      Status:  new                   |      Priority:  Medium 
   Milestone:  1.2.x.x               |     Component:  General
     Version:  RC2                   |      Severity:  Normal 
    Keywords:  shells plugin models  |   Php_version:  PHP 5  
Cake_version:  7296                  |  
-------------------------------------+--------------------------------------
 If you create a new shell which uses a plugin model, lets say:

 {{{
 class NewsletterShell extends Shell {

         var $uses = array('Newsletters.Newsletter');

         function main()
         {
                 echo "this is main function";
         }

         function send()
         {
                 pr($this->Newsletter);
                 echo "This is send function";
         }
 }
 }}}



 The pr() statement will not output anything on the other hand, if I
 pr($this), it shows an object Newsletters.Newsletter, which means its
 loaded, but $modelClass is not good.

 This part of shell.php describes the problem:
 inside def. of Shell::_loadModels():

 {{{

                         foreach ($uses as $modelClass) {
                                 if (PHP5) {
                                         $this->{$modelClass} =
 ClassRegistry::init($modelClass);
                                 } else {
                                         $this->{$modelClass} =&
 ClassRegistry::init($modelClass);
                                 }
                         }
 }}}


 $modelClass needs to be checked for plugin

 {{{
                 if (strpos($modelClass, '.') !== false) {
                         list($plugin, $modelClass) = explode('.',
 $modelClass);
                         $plugin = $plugin . '.';
                 }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5566>
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to