Actions

API17

Difference between revisions of "JModel"

From Joomla! Documentation

(Bulk upload by Doxiki2)
 
m (User contributed notes: bad link repair)
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 +
=={{JVer|11.1}} JModel==
 +
===Description===
 +
{{Description:JModel}}
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[Description:JModel|Edit Descripton]]<nowiki>]</nowiki>
 
<nowiki>[</nowiki>[[Description:JModel|Edit Descripton]]<nowiki>]</nowiki>
 
</span>
 
</span>
{{Description:JModel}}
 
===Defined in===
 
libraries/joomla/application/component/model.php
 
===Subpackage===
 
[[Subpackage Application/11.1|Application]]
 
===Extends===
 
[[JObject/11.1|JObject]]
 
===Extended by===
 
* [[JModelForm/11.1|JModelForm]]
 
* [[JModelItem/11.1|JModelItem]]
 
* [[JModelList/11.1|JModelList]]
 
 
===Methods===
 
===Methods===
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
 
|-
 
|-
 +
!Visibility
 
!Method name
 
!Method name
 
!Description
 
!Description
 
|-
 
|-
 +
|public
 
|[[JModel::__construct/11.1|__construct]]
 
|[[JModel::__construct/11.1|__construct]]
 
|Constructor.  
 
|Constructor.  
 
|-
 
|-
 +
|public
 
|[[JModel::getDbo/11.1|getDbo]]
 
|[[JModel::getDbo/11.1|getDbo]]
 
|Method to get the database connector object.  
 
|Method to get the database connector object.  
 
|-
 
|-
 +
|public
 
|[[JModel::getName/11.1|getName]]
 
|[[JModel::getName/11.1|getName]]
 
|Method to get the model name.  
 
|Method to get the model name.  
 
|-
 
|-
 +
|public
 
|[[JModel::getState/11.1|getState]]
 
|[[JModel::getState/11.1|getState]]
 
|Method to get model state variables.  
 
|Method to get model state variables.  
 
|-
 
|-
 +
|public
 
|[[JModel::getTable/11.1|getTable]]
 
|[[JModel::getTable/11.1|getTable]]
 
|Method to get a table object, load it if necessary.  
 
|Method to get a table object, load it if necessary.  
 
|-
 
|-
 +
|public
 
|[[JModel::setDbo/11.1|setDbo]]
 
|[[JModel::setDbo/11.1|setDbo]]
 
|Method to set the database connector object.  
 
|Method to set the database connector object.  
 
|-
 
|-
 +
|public
 
|[[JModel::setState/11.1|setState]]
 
|[[JModel::setState/11.1|setState]]
 
|Method to set model state variables.  
 
|Method to set model state variables.  
 
|-
 
|-
 +
|public static
 
|[[JModel::addIncludePath/11.1|addIncludePath]]
 
|[[JModel::addIncludePath/11.1|addIncludePath]]
 
|Add a directory where  should search for models.  
 
|Add a directory where  should search for models.  
 
|-
 
|-
 +
|public static
 
|[[JModel::addTablePath/11.1|addTablePath]]
 
|[[JModel::addTablePath/11.1|addTablePath]]
 
|Adds to the stack of model table paths in LIFO order.  
 
|Adds to the stack of model table paths in LIFO order.  
 
|-
 
|-
 +
|public static
 
|[[JModel::getInstance/11.1|getInstance]]
 
|[[JModel::getInstance/11.1|getInstance]]
 
|Returns a Model object, always creating it.  
 
|Returns a Model object, always creating it.  
 
|-
 
|-
 +
|protected
 
|[[JModel::_getList/11.1|_getList]]
 
|[[JModel::_getList/11.1|_getList]]
 
|Gets an array of objects from the results of database query.  
 
|Gets an array of objects from the results of database query.  
 
|-
 
|-
 +
|protected
 
|[[JModel::_getListCount/11.1|_getListCount]]
 
|[[JModel::_getListCount/11.1|_getListCount]]
 
|Returns a record count for the query.  
 
|Returns a record count for the query.  
 
|-
 
|-
 +
|protected
 
|[[JModel::populateState/11.1|populateState]]
 
|[[JModel::populateState/11.1|populateState]]
 
|Method to auto-populate the model state.  
 
|Method to auto-populate the model state.  
 
|-
 
|-
 
|}
 
|}
 +
* '''Defined in''' libraries/joomla/application/component/model.php
 +
* '''Extends''' [[JObject/11.1|JObject]]
 +
* '''Extended by'''
 +
** [[JModelForm/11.1|JModelForm]]
 +
** [[JModelItem/11.1|JModelItem]]
 +
** [[JModelList/11.1|JModelList]]
 
===Importing===
 
===Importing===
 
<source lang="php">jimport( 'joomla.application.component.model' );</source>
 
<source lang="php">jimport( 'joomla.application.component.model' );</source>
 
===See also===
 
===See also===
* [[JModel|Other versions of this class]]
+
* {{JVer|11.1}} '''JModel source code''' on [[jplatform:application/component/model.php|BitBucket]]
 +
* {{JVer|11.1}} Subpackage [[Subpackage Application/11.1|Application]]
 +
* [[JModel|Other versions of JModel]]
 
{{SeeAlso:JModel}}
 
{{SeeAlso:JModel}}
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JModel|Edit See Also]]<nowiki>]</nowiki>
 
<nowiki>[</nowiki>[[SeeAlso:JModel|Edit See Also]]<nowiki>]</nowiki>
 
</span>
 
</span>
===Examples===
+
===User contributed notes===
 
<CodeExamplesForm />
 
<CodeExamplesForm />
 
<dpl>
 
<dpl>
Line 76: Line 90:
 
category=ClassExample
 
category=ClassExample
 
include=*
 
include=*
 +
namespace=CodeExample
 
format= ,,,
 
format= ,,,
 
</dpl>
 
</dpl>
<noinclude>[[Category:Platform]][[Category:Platform 11.1]][[Category:JModel]]</noinclude>
+
<noinclude>[[Category:Platform JClasses]][[Category:Platform 11.1]][[Category:JModel]]</noinclude>

Revision as of 13:57, 29 August 2012

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Joomla 11.1 JModel

Description

JModel is an abstract class which provides the basic functionality for concrete model objects in conjunction with Joomla's MVC pattern. Models that extend the JModel class are often defined in Joomla components and define the business logic of the specific component. See MVC Development in Joomla

The Joomla MVC Design Pattern

Model-View-Controller (MVC) is a set of design patterns, that are used to separate the different layers of your application.

  • The View displays the data of the model by passing it to a template. The view object can therefore access the data of the model. Joomla implements the basic functionality in the abstract JView class.
  • The Model stores the data of the application, and contains the business logic. Joomla implements the basic functionality in the abstract JModel class.
  • The Controller handles the user requests and evokes the model and the views to change it's state. Joomla implements the basic functionality in the JController class.

[Edit Descripton]

Methods

Visibility Method name Description
public __construct Constructor.
public getDbo Method to get the database connector object.
public getName Method to get the model name.
public getState Method to get model state variables.
public getTable Method to get a table object, load it if necessary.
public setDbo Method to set the database connector object.
public setState Method to set model state variables.
public static addIncludePath Add a directory where should search for models.
public static addTablePath Adds to the stack of model table paths in LIFO order.
public static getInstance Returns a Model object, always creating it.
protected _getList Gets an array of objects from the results of database query.
protected _getListCount Returns a record count for the query.
protected populateState Method to auto-populate the model state.

Importing

jimport( 'joomla.application.component.model' );

See also

SeeAlso:JModel [Edit See Also]

User contributed notes

<CodeExamplesForm />