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:

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 to Content.
  • string $prefix (optional): Class prefix. Defaults to JTable.
  • 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 />';