$newMembership = JTable::getInstance('MembershipSold', 'Table');
$newMembership->load($this->membership_sold_id);
$this->membership_sold = $newMembership;
$dispatcher->trigger('onAfterMembershipChanged', array($newMembership));
return parent::store();/* whats the use of above code */
1 Answers
$newMembership = JTable::getInstance('MembershipSold', 'Table');
This line is getting is a static method to get an instance of a JTable class, specifically one called "MembershipSold". You can read about JTable (Joomla's abstract table class) here, the document is a little out of date but you can read the relevant JTable class in your Joomla installation at/libraries/joomla/database/table.php
$newMembership->load($this->membership_sold_id);
This line uses themembership_sold_id
to load a record from the table in the database.$this->membership_sold = $newMembership;
This line inserts the JTable object (now holding the record loaded from the table) into the$this
.$dispatcher->trigger('onAfterMembershipChanged', array($newMembership));
This line appears to be triggering an event and passing in the$newMembership
object (Joomla supports a basic event system for plugins etc to act on), you can read more about it in this document "Supporting plugins in your component"return parent::store();
This line is calling the current objectsparent
'sstore()
method. See PHP:parent

- 9,335
- 2
- 34
- 38