Добавил getItemByIdentifier в ClientModel

This commit is contained in:
Artem Vasilev 2024-03-06 12:52:13 +03:00
parent dc4b1734ab
commit 58a6631164

View File

@ -9,6 +9,8 @@ use Joomla\CMS\MVC\Model\AdminModel;
class ClientModel extends AdminModel class ClientModel extends AdminModel
{ {
use GetItemByIdentifierTrait;
/** /**
* The type alias for this content type. * The type alias for this content type.
* *
@ -17,15 +19,6 @@ class ClientModel extends AdminModel
*/ */
public $typeAlias = 'com_oauthserver.client'; public $typeAlias = 'com_oauthserver.client';
/**
* Client item.
*
* @var array|null
*
* @since 1.0.0
*/
protected ?array $_item = null;
/** /**
* @param array $data * @param array $data
* @param bool $loadData * @param bool $loadData
@ -87,10 +80,10 @@ class ClientModel extends AdminModel
if ($task === 'save2reset' || empty($table->id)) { if ($task === 'save2reset' || empty($table->id)) {
$table->identifier = $this->generateNewIdentifier(); $table->identifier = $this->generateNewIdentifier();
$table->secret = $table->public ? '' : $this->generateNewSecret(); $table->secret = !!$table->public ? '' : $this->generateNewSecret();
} }
if ($table->public) { if (!!$table->public) {
$table->secret = ''; $table->secret = '';
} else { } else {
if (empty($table->secret)) { if (empty($table->secret)) {