forked from joomla/Component-Builder
Fixed alias builder #973
This commit is contained in:
parent
7edbe20c33
commit
7fa8964b44
@ -140,7 +140,7 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 29th January, 2023
|
||||
+ *Last Build*: 6th February, 2023
|
||||
+ *Version*: 3.1.13
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -140,7 +140,7 @@ TODO
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 29th January, 2023
|
||||
+ *Last Build*: 6th February, 2023
|
||||
+ *Version*: 3.1.13
|
||||
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="4" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>29th January, 2023</creationDate>
|
||||
<creationDate>6th February, 2023</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||
|
@ -147,10 +147,10 @@ class Builder
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
$this->event = $event ?: Compiler::_('Event');
|
||||
$this->counter = $counter ?? Compiler::_('Utilities.Counter');
|
||||
$this->folder = $folder ?? Compiler::_('Utilities.Folder');
|
||||
$this->file = $file ?? Compiler::_('Utilities.File');
|
||||
$this->files = $files ?? Compiler::_('Utilities.Files');
|
||||
$this->counter = $counter ?: Compiler::_('Utilities.Counter');
|
||||
$this->folder = $folder ?: Compiler::_('Utilities.Folder');
|
||||
$this->file = $file ?: Compiler::_('Utilities.File');
|
||||
$this->files = $files ?: Compiler::_('Utilities.Files');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,10 +147,10 @@ class Builder
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->dispenser = $dispenser ?: Compiler::_('Customcode.Dispenser');
|
||||
$this->event = $event ?: Compiler::_('Event');
|
||||
$this->counter = $counter ?? Compiler::_('Utilities.Counter');
|
||||
$this->folder = $folder ?? Compiler::_('Utilities.Folder');
|
||||
$this->file = $file ?? Compiler::_('Utilities.File');
|
||||
$this->files = $files ?? Compiler::_('Utilities.Files');
|
||||
$this->counter = $counter ?: Compiler::_('Utilities.Counter');
|
||||
$this->folder = $folder ?: Compiler::_('Utilities.Folder');
|
||||
$this->file = $file ?: Compiler::_('Utilities.File');
|
||||
$this->files = $files ?: Compiler::_('Utilities.Files');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Model;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Config;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Registry;
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Field\Name as FieldName;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\ArrayHelper;
|
||||
@ -27,12 +27,12 @@ use VDM\Joomla\Utilities\ArrayHelper;
|
||||
class Customalias
|
||||
{
|
||||
/**
|
||||
* The compiler Config
|
||||
* The compiler Registry
|
||||
*
|
||||
* @var Config
|
||||
* @var Registry
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Config $config;
|
||||
protected Registry $registry;
|
||||
|
||||
/**
|
||||
* The compiler field name
|
||||
@ -45,14 +45,14 @@ class Customalias
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config|null $config The compiler registry object.
|
||||
* @param Registry|null $registry The compiler registry object.
|
||||
* @param FieldName|null $fieldName The compiler field name object.
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function __construct(?Config $config = null, ?FieldName $fieldName = null)
|
||||
public function __construct(?Registry $registry = null, ?FieldName $fieldName = null)
|
||||
{
|
||||
$this->config = $config ?: Compiler::_('Config');
|
||||
$this->registry = $registry ?: Compiler::_('Registry');
|
||||
$this->fieldName = $fieldName ?: Compiler::_('Field.Name');
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class Customalias
|
||||
*/
|
||||
public function set(object &$item)
|
||||
{
|
||||
if (!$this->config->get('builder.custom_alias.' . $item->name_single_code, null)
|
||||
if (!$this->registry->get('builder.custom_alias.' . $item->name_single_code, null)
|
||||
&& isset($item->alias_builder_type) && 2 == $item->alias_builder_type
|
||||
&& isset($item->alias_builder) && JsonHelper::check($item->alias_builder))
|
||||
{
|
||||
@ -90,7 +90,7 @@ class Customalias
|
||||
if (ArrayHelper::check($alias_fields))
|
||||
{
|
||||
// load the field names
|
||||
$this->config->set('builder.custom_alias.' . $item->name_single_code,
|
||||
$this->registry->set('builder.custom_alias.' . $item->name_single_code,
|
||||
(array) array_map(
|
||||
function ($field) use (&$item) {
|
||||
return $this->fieldName->get(
|
||||
|
@ -431,7 +431,7 @@ class Model implements ServiceProviderInterface
|
||||
public function getModelCustomalias(Container $container): Customalias
|
||||
{
|
||||
return new Customalias(
|
||||
$container->get('Config'),
|
||||
$container->get('Registry'),
|
||||
$container->get('Field.Name')
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user