getmodel() argument 'ignore_request'

636 views
Skip to first unread message

souleye

unread,
Jun 12, 2012, 11:02:52 AM6/12/12
to joomla-de...@googlegroups.com
hi all, after a few years hiatus I'm getting back to developing for joomla. I'm trying to learn how to develop components. on the getmodel() method there's an argument array('ignore_request' => true) I don't understand that part 'ignore_request => true' if anyone can explain that to me, I'll appreciate it. thanks.
souleye

Phil Brown

unread,
Jun 12, 2012, 9:35:49 PM6/12/12
to joomla-de...@googlegroups.com
Joomla Models have a method called populateState() that is automatically called if that flag is not set.

The following automatically call the models populateState() method which usually includes some state setters based on the request.
$model = JModel::getInstance('MyModel', 'XYZModel');
$item = $model->getItem();

The following allows you to ignore the request and set your own state setters
$model = JModel::getInstance('MyModel', 'XYZModel', array('ignore_request'=>true));
$model->setState('filter.id', 123);
$item = $model->getItem();

Regards,

Phill Brown
M  04 2481 9754
Bathurst Software Solutions
-------------------------------------------------------------------------------------------------------------------



On Wed, Jun 13, 2012 at 1:02 AM, souleye <sou...@gmail.com> wrote:
hi all, after a few years hiatus I'm getting back to developing for joomla. I'm trying to learn how to develop components. on the getmodel() method there's an argument array('ignore_request' => true) I don't understand that part 'ignore_request => true' if anyone can explain that to me, I'll appreciate it. thanks.

souleye

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/5Q1f5v1KpkUJ.
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.

souleye

unread,
Jun 12, 2012, 11:11:08 PM6/12/12
to joomla-de...@googlegroups.com
thanks a lot. I tried to go to doc.joomla.org but it's very depressing. you can hardly find anything useful. makes me wonder how you guys got to know what you know. I got this from the book 'joomla programming' but they didn't think it was worthwhile explaining it. that's enough for me to work with. 


On Tuesday, June 12, 2012 9:35:49 PM UTC-4, Phil Brown wrote:
Joomla Models have a method called populateState() that is automatically called if that flag is not set.

The following automatically call the models populateState() method which usually includes some state setters based on the request.
$model = JModel::getInstance('MyModel', 'XYZModel');
$item = $model->getItem();

The following allows you to ignore the request and set your own state setters
$model = JModel::getInstance('MyModel', 'XYZModel', array('ignore_request'=>true));
$model->setState('filter.id', 123);
$item = $model->getItem();

Regards,

Phill Brown
M  04 2481 9754
Bathurst Software Solutions
-------------------------------------------------------------------------------------------------------------------



On Wed, Jun 13, 2012 at 1:02 AM, souleye <sou...@gmail.com> wrote:
hi all, after a few years hiatus I'm getting back to developing for joomla. I'm trying to learn how to develop components. on the getmodel() method there's an argument array('ignore_request' => true) I don't understand that part 'ignore_request => true' if anyone can explain that to me, I'll appreciate it. thanks.

souleye

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/5Q1f5v1KpkUJ.
To post to this group, send an email to joomla-dev-general@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-general+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages