- md5
- 3c6375fa7d729bf4be6cdc6e9bc08abd
- sha1
- b4ac66961a9838d364db9b436ba338be543d3ffc
- sha256
- 774d7c633e845a6cc13077279097ecfa2379a3e67cf526990848b36c2f4a95bf
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
<?php
/**
* @package Joomla.Administrator
* @subpackage com_guidedtours
*
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Component\Guidedtours\Administrator\Table;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;
use Joomla\CMS\User\CurrentUserInterface;
use Joomla\CMS\User\CurrentUserTrait;
use Joomla\Database\DatabaseDriver;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Step table class.
*
* @since 4.3.0
*/
class StepTable extends Table implements CurrentUserInterface
{
use CurrentUserTrait;
/**
* Indicates that columns fully support the NULL value in the database
*
* @var boolean
* @since 4.3.0
*/
protected $_supportNullValue = true;
/**
* Constructor
*
* @param DatabaseDriver $db Database connector object
*
* @since 4.3.0
*/
public function __construct(DatabaseDriver $db)
{
parent::__construct('#__guidedtour_steps', 'id', $db);
}
/**
* Stores a step.
*
* @param boolean $updateNulls True to update fields even if they are null.
*
* @return boolean True on success, false on failure.
*
* @since 4.3.0
*/
public function store($updateNulls = true)
{
$date = Factory::getDate()->toSql();
$userId = $this->getCurrentUser()->id;
// Set created date if not set.
if (!(int) $this->created) {
$this->created = $date;
}
if ($this->id) {
// Existing item
$this->modified_by = $userId;
$this->modified = $date;
} else {
// Field created_by field can be set by the user, so we don't touch it if it's set.
if (empty($this->created_by)) {
$this->created_by = $userId;
}
if (!(int) $this->modified) {
$this->modified = $date;
}
if (empty($this->modified_by)) {
$this->modified_by = $userId;
}
}
return parent::store($updateNulls);
}
}
The same content is in 4 releases, Joomla 5.0.0-alpha1 to 5.0.0-alpha4. See them all, or every version of this file.