[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [jfw] Access config in Model



I think you can pass required configuration options to the model from the Controller.
It should have access to config trough the Container and it's initializing new models, so



On Tuesday, March 18, 2014 5:59:41 PM UTC+1, Michael Babker wrote:
You would need to pass in the config data when you instantiate your model class.  There isn't a getApplication() method in our models nor is it recommended your model has access to your DI container.  You could do this by passing a Registry object in with your config data attached to it.

On Tuesday, March 18, 2014, <sach... AT tekdi.net> wrote:
Hello Everyone,

I'm new in Joomla framework. In Joomla Framework I want to access config file in the model file. 

I have tried it by following ways, but I'm not able to access it. 

1. $this->getApplication()->config->get();
2. $this->getContainer()->config->get();

And one more question is, how to access getApplication(function in Model file?

--
Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.


--
- Michael

Please pardon any errors, this message was sent from my iPhone.

--
Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
---
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.