CoreFiles by mySites.guru
TransitionTable.php89 lines, 2,105 bytes, from Joomla_4.0.0-alpha9-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha8
md5
ee770b902d2d2c355dec48d899ba4cc4
sha1
b0758ef7ffbad3ade93054c9e1ed345785b2b36c
sha256
c0084ec2700459b4c309d97e77fb12e88a071c0bc039077a92627f015b815eb4
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_workflow
 *
 * @copyright   Copyright (C) 2005 - 2019 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 3 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha9. See them all, or every version of this file.