There have also been other occasions where I would like to call function from the model of one component from within the code of another component.
Thanks for trying.
Dommod
(...)
If I have two MVC components A and B, is there a preferred way of calling methods in one of A's models from within B's code. I know I can simply use php's require function, but will that allow me to lever the full power of the A's MVC structure, for example will it work if I want to call a method from A which uses JTable to access the database?
--To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/WrqEthu8gEQJ.
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.
Is what you are suggesting possible (I'm guessing that from laoneo's response that it's not). From the experimenting I've been doing it seems that it's possible to use the getInstance method of the JModel class to instantiate a model from another controller (if you include that class first), but JContollers getInstance methode doesn't seem to allow this.
If you know a neat way to expose the methods of a controller in one component to a controller in another component, then I'd be really interested.