If you don't need the component callbacks, then I wouldn't use
components but simple PHP classes stored in the components folder
(resp. for organizational purposes in a subfolder). An idea of how it
could like:
App::import('Component', 'MyFactory');
class MyController extends AppController {
public function index() {
$myComponent = MyFactory::getMyComponent('ReservationHotel',
$this);
}
}
App::import('Component', 'AbstractClass');
class MyFactory {
public static function getMyComponent($componentName, $controller)
{
if ($componentName == 'ReservationHotel') {
App::import('Component', 'ReservationHotel');
return new ReservationHotel($controller);
}
}
}
class ReservationHotel extends AbstractClass {
private $controller = null;
public function __construct($controller) {
$this->controller = $controller;
}
// implementation of the methods defined in the abstract class
}
--
Daniel Hofstetter
http://cakebaker.42dh.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---