Re: reading table from a component
You can try just doing $variable =& new $Model; inside your component. This will create a reference to the model for you without relying on the controller. Bryan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: reading table from a component
I am not sure exactly what is your intention, but isn't the problem using same name for Model and Component?Either reference must be overwritten in controller.Also, if you want to access to model and/or set data for view, it should be done through controller, I believe.So, in component, it should be$this->controller->set('product_sections', $this->controller->ProductSection->findAll());Sohei --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: reading table from a component
Sorry, this is me being absolutely stupid. My problem, which is probably totally unrelated to Zoltan's, was that my User model was in a plugin (I thought it'd be easier to organise it that way). Hence whenever I wasn't in the plugin, my main application couldn't access the model for it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: reading table from a component
Scratch that, my implementation was broken, and currently I don't know why. Perhaps someone more experienced can tell the both of us how exactly we can access Models in Components? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: reading table from a component
You should be able to use $this->controller->ProductSection to get access to your model, it's what I've done in my Auth component and it seems to work ok. It's just that extra level of redirection there :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
reading table from a component
Hi, I'm quite new to Cake and I have a question about components/elements Basically I have a site where there will be a list of categories on different pages e.g. var $name = 'Searches'; var $components = array('ProductSection'); var $uses = 'ProductSection'; function index() { $this->ProductSection->Setup(); ... and a element (renderElement('categories_list', ); ?>) class ProductSectionComponent extends Object { //var $someVar = null; // var $controller = true; function startup(& $controller) { $this->controller = & $controller; } function Setup() { $this->set('product_sections', $this->ProductSection->findAll()); } ... I want to know what I how to set this up, can I select the model inside the component? Hope this makes sense, I've been trying various ways but keep getting errors. Z --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---