CoreContent
class CoreContent extends Table implements CurrentUserInterface
Core content table
Traits
Trait for classes which require a user to work with.
Trait which contains the legacy methods that formerly were inherited from \Joomla\CMS\Object\CMSObject to set and get errors in a class.
Trait which contains the legacy methods that formerly were inherited from \Joomla\CMS\Object\CMSObject to set and get properties of the current class.
Properties
protected array
deprecated
Since: 1.7.0
|
$_errors | An array of error messages or Exception objects. |
from LegacyErrorHandlingTrait |
protected string
Since: 1.7.0
|
$_tbl | Name of the database table to model. |
from Table |
protected string
Since: 1.7.0
|
$_tbl_key | Name of the primary key field in the table. |
from Table |
protected array
Since: 3.0.1
|
$_tbl_keys | Name of the primary key fields in the table. |
from Table |
protected DatabaseDriver
Since: 1.7.0
|
$_db | DatabaseDriver object. |
from Table |
protected bool
Since: 1.7.0
|
$_trackAssets | Should rows be tracked as ACL assets? |
from Table |
protected Rules
Since: 1.7.0
|
$_rules | The rules associated with this record. |
from Table |
protected bool
Since: 1.7.0
|
$_locked | Indicator that the tables have been locked. |
from Table |
protected bool
Since: 3.1.4
|
$_autoincrement | Indicates that the primary keys autoincrement. |
from Table |
protected array
Since: 3.4.0
|
$_columnAlias | Array with alias for "special" columns such as ordering, hits etc etc |
from Table |
protected array
Since: 4.0.0
|
$_jsonEncode | An array of key names to be json encoded in the bind method |
|
protected bool
Since: 4.0.0
|
$_supportNullValue | Indicates that columns fully support the NULL value in the database |
|
string
Since: 4.0.0
|
$typeAlias | The UCM type alias. Used for tags, content versioning etc. Leave blank to effectively disable these features. |
from Table |
Methods
Sets a default value if not already assigned
Returns a property of the object or the default value if the property is not set.
Modifies a property of the object, creating it if it does not already exist.
Constructor
Static method to get an instance of a Table class if it can be found in the table include paths.
Add a filesystem path where Table should search for table class files.
Method to get the parent asset under which to register this one.
Method to append the primary keys for this table to a query.
Method to get the primary key field name for the table.
Method to reset class properties to the defaults set in the class definition.
Method to bind an associative array or object to the TableInterface instance.
Method to load a row from the database by primary key and bind the fields to the TableInterface instance properties.
Overloaded check function
Overrides Table::store to set modified data and user id.
Method to provide a shortcut to binding, checking and storing a Table instance to the database table.
Override \Joomla\CMS\Table\Table delete method to include deleting corresponding row from #__ucm_base.
Method to check a row out if the necessary properties/fields exist.
Method to check a row in if the necessary properties/fields exist.
Method to increment the hits for a row if the necessary property/field exists.
Method to determine if a row is checked out and therefore uneditable by a user.
Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.
Get the primary key values for this table using passed in values as a default.
Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.
Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
Method to set the publishing state for a row or list of rows in the database table.
Method to return the real name of a "special" column such as ordering, hits, published etc etc. In this way you are free to follow your db naming convention and use the built in \Joomla functions.
Method to register a column alias for a "special" column.
Check if the record has a property (applying a column alias if it exists)
Returns the current user, if none is set the identity of the global app is returned. This will change in 6.0 and an empty user will be returned.
Method to delete a row from the #__ucm_content table by content_item_id.
Insert or update row in ucm_base table
Details
string
getError(int $i = null, bool $toString = true)
deprecated
deprecated 3.1.4 will be removed in 6.0 Will be removed without replacement Catch thrown Exceptions instead of getError
Get the most recent error message.
array
getErrors()
deprecated
deprecated 3.1.4 will be removed in 6.0 Will be removed without replacement Catch thrown Exceptions instead of getErrors
Return all errors, if any.
void
setError(string $error)
deprecated
deprecated 3.1.4 will be removed in 6.0 Will be removed without replacement Throw an Exception instead of using setError
Add an error message.
mixed
def(string $property, mixed $default = null)
deprecated
deprecated 4.3.0 will be removed in 6.0 Defining dynamic properties should not be used anymore
Sets a default value if not already assigned
mixed
get(string $property, mixed $default = null)
deprecated
deprecated 4.3.0 will be removed in 6.0 Create a proper getter function for the property
Returns a property of the object or the default value if the property is not set.
array
getProperties(bool $public = true)
deprecated
deprecated 4.3.0 will be removed in 6.0 Create a proper getter function for the property
Returns an associative array of object properties.
mixed
set(string $property, mixed $value = null)
deprecated
deprecated 4.3.0 will be removed in 6.0 Create a proper setter function for the property
Modifies a property of the object, creating it if it does not already exist.
bool
setProperties(mixed $properties)
deprecated
deprecated 4.3.0 will be removed in 6.0 Create a proper setter function for the property
Set the object properties based on a named array/hash.
static Table|bool
getInstance(string $type, string $prefix = 'JTable', array $config = [])
deprecated
deprecated 4.3 will be removed in 6.0 Use the MvcFactory instead Example: Factory::getApplication()->bootComponent('...')->getMVCFactory()->createTable($name, $prefix, $config);
Static method to get an instance of a Table class if it can be found in the table include paths.
To add include paths for searching for Table classes see Table::addIncludePath().
static array
addIncludePath(array|string $path = null)
deprecated
deprecated 4.3 will be removed in 6.0 Should not be used anymore as tables are loaded through the MvcFactory
Add a filesystem path where Table should search for table class files.
protected string
_getAssetName()
Method to compute the default name of the asset.
The default name is in the form table_name.id where id is the value of the primary key of the table.
protected string
_getAssetTitle()
Method to return the title to use for the asset table.
In tracking the assets a title is kept for each asset so that there is some context available in a unified access manager. Usually this would just return $this->title or $this->name or whatever is being used for the primary name of the row. If this method is not overridden, the asset name is used.
protected int
_getAssetParentId(Table|null $table = null, ?int $id = null)
Method to get the parent asset under which to register this one.
By default, all assets are registered to the ROOT node with ID, which will default to 1 if none exists. An extended class can define a table and ID to lookup. If the asset does not exist it will be created.
void
appendPrimaryKeys(DatabaseQuery $query, mixed $pk = null)
Method to append the primary keys for this table to a query.
string
getKeyName(bool $multiple = false)
Method to get the primary key field name for the table.
void
reset()
Method to reset class properties to the defaults set in the class definition.
It will ignore the primary key as well as any private class properties.
bool
bind(mixed $src, mixed $ignore = [])
Method to bind an associative array or object to the TableInterface instance.
This method only binds properties that are publicly accessible and optionally takes an array of properties to ignore when binding.
bool
load(mixed $keys = null, bool $reset = true)
Method to load a row from the database by primary key and bind the fields to the TableInterface instance properties.
bool
store(bool $updateNulls = true)
Overrides Table::store to set modified data and user id.
bool
save(array|object $src, string $orderingFilter = '', array|string $ignore = '')
Method to provide a shortcut to binding, checking and storing a Table instance to the database table.
The method will check a row in once the data has been stored and if an ordering filter is present will attempt to reorder the table rows based on the filter. The ordering filter is an instance property name. The rows that will be reordered are those whose value matches the Table instance for the property specified.
bool
delete(mixed $pk = null)
Override \Joomla\CMS\Table\Table delete method to include deleting corresponding row from #__ucm_base.
bool
checkOut(int $userId, mixed $pk = null)
Method to check a row out if the necessary properties/fields exist.
To prevent race conditions while editing rows in a database, a row can be checked out if the fields 'checked_out' and 'checked_out_time' are available. While a row is checked out, any attempt to store the row by a user other than the one who checked the row out should be held until the row is checked in again.
bool
checkIn(mixed $pk = null)
Method to check a row in if the necessary properties/fields exist.
Checking a row in will allow other users the ability to edit the row.
bool
hit(mixed $pk = null)
Method to increment the hits for a row if the necessary property/field exists.
bool
isCheckedOut(int $with = 0, int $against = null)
Method to determine if a row is checked out and therefore uneditable by a user.
If the row is checked out by the same user, then it is considered not checked out -- as the user can still edit it.
int
getNextOrder(string $where = '')
Method to get the next ordering value for a group of rows defined by an SQL WHERE clause.
This is useful for placing a new item last in a group of items in the table.
array
getPrimaryKey(array $keys = [])
Get the primary key values for this table using passed in values as a default.
mixed
reorder(string|string[] $where = '')
Method to compact the ordering values of rows in a group of rows defined by an SQL WHERE clause.
bool
move(int $delta, string|string[] $where = '')
Method to move a row in the ordering sequence of a group of rows defined by an SQL WHERE clause.
Negative numbers move the row up in the sequence and positive numbers move it down.
bool
publish(mixed $pks = null, int $state = 1, int $userId = 0)
Method to set the publishing state for a row or list of rows in the database table.
The method respects checked out rows by other users and will attempt to checkin rows that it can after adjustments are made.
string
getColumnAlias(string $column)
Method to return the real name of a "special" column such as ordering, hits, published etc etc. In this way you are free to follow your db naming convention and use the built in \Joomla functions.
void
setColumnAlias(string $column, string $columnAlias)
Method to register a column alias for a "special" column.
bool
hasField(string $key)
Check if the record has a property (applying a column alias if it exists)
protected User
getCurrentUser()
Returns the current user, if none is set the identity of the global app is returned. This will change in 6.0 and an empty user will be returned.