Does anyone have any idea what this error is when running this command in magento 2: setup:upgrade for a custom module?
Here is the error:
Impossible to process constructor argument Parameter #1 [ <required> MagentoCmsSetupPageSetupFactory $pageSetupFactory ] of ViewSonicMetaRobotsSetupPatchDataAddMetaRobotsAttribute class
Here is the coding:
<?php
namespace ViewSonicMetaRobotsSetupPatchData;
use MagentoCmsSetupPageSetup;
use MagentoCmsSetupPageSetupFactory;
use MagentoFrameworkSetupModuleDataSetupInterface;
use MagentoFrameworkSetupPatchDataPatchInterface;
use MagentoFrameworkSetupPatchPatchVersionInterface;
class AddMetaRobotsAttribute implements DataPatchInterface, PatchVersionInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;
/**
* @var PageSetupFactory
*/
private $pageSetupFactory;
/**
* AddMetaRobotsAttribute constructor.
*
* @param ModuleDataSetupInterface $moduleDataSetup
* @param PageSetupFactory $pageSetupFactory
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
PageSetupFactory $pageSetupFactory
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->pageSetupFactory = $pageSetupFactory;
}
/**
* {@inheritdoc}
*/
public function apply()
{
/** @var PageSetup $pageSetup */
$pageSetup = $this->pageSetupFactory->create(['setup' => $this->moduleDataSetup]);
$pageSetup->addAttribute(
'page',
'meta_robots',
[
'type' => 'varchar',
'label' => 'Meta Robots',
'input' => 'select',
'required' => false,
'sort_order' => 70,
'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_STORE,
'backend' => '',
'frontend' => '',
'default' => '',
'source' => ''
]
);
}
/**
* {@inheritdoc}
*/
public static function getDependencies()
{
return [];
}
/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
/**
* {@inheritdoc}
*/
public static function getVersion()
{
return '2.4.3';
}
}
Any help would be so appreciated. Thanks in advanced