- md5
- 982199f6bcfe439a4f89caddb8db6110
- sha1
- 471c4188558a5ce4a94819cff3a7a397bb4f6649
- sha256
- 78c10d1dc683b07c62840922667e71e3dbae7309e73a2d2cf47c8027464802f1
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
<?php
/**
* @package Joomla.Administrator
* @subpackage com_workflow
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Workflow\Administrator\Table;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
/**
* Transition table
*
* @since 4.0.0
*/
class TransitionTable extends Table
{
/**
* Constructor
*
* @param \JDatabaseDriver $db Database connector object
*
* @since 4.0.0
*/
public function __construct(\JDatabaseDriver $db)
{
parent::__construct('#__workflow_transitions', 'id', $db);
$this->access = (int) Factory::getApplication()->get('access');
}
/**
* 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.
*
* @return string
*
* @since 4.0.0
*/
protected function _getAssetName()
{
$k = $this->_tbl_key;
$workflow = new WorkflowTable($this->getDbo());
$workflow->load($this->workflow_id);
return $workflow->extension . '.transition.' . (int) $this->$k;
}
/**
* Method to return the title to use for the asset table.
*
* @return string
*
* @since 4.0.0
*/
protected function _getAssetTitle()
{
return $this->title;
}
/**
* Get the parent asset id for the record
*
* @param Table $table A JTable object for the asset parent.
* @param integer $id The id for the asset
*
* @return integer The id of the asset's parent
*
* @since 4.0.0
*/
protected function _getAssetParentId(Table $table = null, $id = null)
{
$asset = self::getInstance('Asset', 'JTable', array('dbo' => $this->getDbo()));
$workflow = new WorkflowTable($this->getDbo());
$workflow->load($this->workflow_id);
$name = $workflow->extension . '.workflow.' . (int) $workflow->id;
$asset->loadByName($name);
$assetId = $asset->id;
return !empty($assetId) ? $assetId : parent::_getAssetParentId($table, $id);
}
}
The same content is in 2 releases, Joomla 4.0.0-alpha5 to 4.0.0-alpha6. See them all, or every version of this file.