CoreFiles by mySites.guru
MapTable.php80 lines, 1,577 bytes, from Joomla_4.0.0-beta5-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta4
md5
4160e6df9c6d9704efca7c4685627e76
sha1
d63b9ae9a0f4dc7a5380672bcb1733feee3b12f2
sha256
d9f7610ddb3c0601c779f004e408c884e4d8ebaf749528ab2d0621fdaaad3bc0
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_finder
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Component\Finder\Administrator\Table;

\defined('_JEXEC') or die;

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Nested;
use Joomla\Database\DatabaseDriver;

/**
 * Map table class for the Finder package.
 *
 * @since  2.5
 */
class MapTable extends Nested
{
	/**
	 * Constructor
	 *
	 * @param   DatabaseDriver  $db  Database Driver connector object.
	 *
	 * @since   2.5
	 */
	public function __construct(DatabaseDriver $db)
	{
		parent::__construct('#__finder_taxonomy', 'id', $db);

		$this->setColumnAlias('published', 'state');
		$this->access = (int) Factory::getApplication()->get('access');
	}

	/**
	 * Override check function
	 *
	 * @return  boolean
	 *
	 * @see     Table::check()
	 * @since   4.0.0
	 */
	public function check()
	{
		try
		{
			parent::check();
		}
		catch (\Exception $e)
		{
			$this->setError($e->getMessage());

			return false;
		}

		// Check for a title.
		if (trim($this->title) == '')
		{
			$this->setError(Text::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY'));

			return false;
		}

		$this->alias = ApplicationHelper::stringURLSafe($this->title, $this->language);

		if (trim($this->alias) == '')
		{
			$this->alias = md5(serialize($this->getProperties()));
		}

		return true;
	}
}

The same content is in 3 releases, Joomla 4.0.0-beta3 to 4.0.0-beta5. See them all, or every version of this file.