タグ付けされた質問 「di.xml」

6
現在のエリアでは削除操作は禁止されています
skuによる簡単な商品の削除操作用のコマンドを作成したい。次のエラーが発生します。管理領域の設定方法は? [Magento \ Framework \ Exception \ LocalizedException] 現在のエリアでは削除操作は禁止されています <?php namespace Sivakumar\Sample\Console; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputOption; class DeleteSimpleProduct extends Command { protected $_product; public function __construct(\Magento\Catalog\Model\Product $_product) { $this->_product =$_product; parent::__construct(); } /** * {@inheritdoc} */ protected function configure() { $this->setName('delete_simple_product') ->setDescription('Delete Simple Product') ->setDefinition($this->getOptionsList()); parent::configure(); …

3
Magento 2にCLIコマンドを追加するための正しいサポートされている方法
Magento 2モジュールにCLIコマンドを追加するための正しい正式にサポートされた方法はありますか?私が集めたものからあなたのオプションは コマンドクラスをファイル経由でのcommands引数に追加しますMagento\Framework\Console\CommandListdi.xml 経由でコマンドを登録\Magento\Framework\Console\CommandLocator::register中registration.phpのファイルまたはcli_commands.phpファイル これらのオプションはいずれもで祝福されていません@api。拡張機能の開発者として、コマンドラインスクリプトを追加して、バージョン間で固執する方法は明確ではありません。 これを行うためのThe Right™の方法に関する公式のMagentoポリシーがあるかどうか誰かが知っていますか?

2
Magento 2 Afterパラメータ付きプラグイン
次のメソッドにプラグイン後を実装しようとしています。 public function getCategoryUrl($category) { if ($category instanceof ModelCategory) { return $category->getUrl(); } return $this->_categoryFactory->create()->setData($category->getData())->getUrl(); } $category上記のメソッドに渡されるパラメータに注意してください。 解決策として、以下のコードを実装しました。 public function afterGetCategoryUrl(\Magento\Catalog\Helper\Category $subject, $result) { return $result; } 今、私の質問は$category、親メソッドでパラメーターをプラグインに渡すにはどうすればよいですか?$categoryオブジェクトの特定の値に基づいて結果を変更したいだけです。
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.