Article entity
Phproberto\Joomla\Entity\Content\Article
Represents a com_content article.
Index
Usage
To start using this entity you have to load the phproberto_library
and add the use statement like:
\JLoader::import('phproberto_entity.library');
use Phproberto\Joomla\Entity\Content\Article;
// Load the article with id = 1
$article = Article::instance(1);
Methods
This entity has these methods available:
Traits
This class allows you to use methods defined in these traits:
- Phproberto\Joomla\Entity\Categories\Traits\HasCategory
- Phproberto\Joomla\Entity\Core\Traits\HasAccess
- Phproberto\Joomla\Entity\Core\Traits\HasAsset
- Phproberto\Joomla\Entity\Core\Traits\HasAssociations
- Phproberto\Joomla\Entity\Core\Traits\HasFeatured
- Phproberto\Joomla\Entity\Core\Traits\HasImages
- Phproberto\Joomla\Entity\Core\Traits\HasLink
- Phproberto\Joomla\Entity\Core\Traits\HasMetadata
- Phproberto\Joomla\Entity\Core\Traits\HasParams
- Phproberto\Joomla\Entity\Core\Traits\HasState
- Phproberto\Joomla\Entity\Core\Traits\HasTranslations
- Phproberto\Joomla\Entity\Core\Traits\HasUrls
- Phproberto\Joomla\Entity\Tags\Traits\HasTags
- Phproberto\Joomla\Entity\Users\Traits\HasAuthor
- Phproberto\Joomla\Entity\Users\Traits\HasEditor
table($name = ‘’, $prefix = null, $options = array())
Get a table instance. Defauts to \JTableContent. Most of the times you don’t want to access this because entity handles most stuff that requires table access.
Parameters:
string
$name (optional): Table name. Defaults toContent
.string
$prefix (optional): Class prefix. Defaults toJTable
.array
$options (optional): Configuration array for the table.
Returns:
\JTable
Throws:
\InvalidArgumentException
if table cannot be loaded.
Examples:
$article = new Article(74);
echo 'Title before `' . $article->get('title') . '`<br />';
$article->bind(array('title' => 'My new title'));
// This will show `My new title`
echo 'Title after `' . $article->get('title') . '`<br />';