0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ECCUBE4 PHP Fatal error: "Cannot declare class [クラス名], because the name is already in use in ****.php on line 0

Posted at

発生状況

プラグインで管理画面の商品検索Formをカスタマイズしようと
インストールコマンドを叩いたところ、以下のエラーに遭遇しました。

# インストールコマンド実行
bin/console eccube:plugin:install --code=AdminProductSearchCustomize

Compile Error: Cannot declare class 
 AdminProductSearchCustomize\Form\Extension\AdminSearchProductTypeExtension, 
because the name is already in use  
      
# キャッシュ削除実行するも変わらず。
bin/console cache:clear --no-warmup

PHP Fatal error:  Cannot declare class AdminProductSearchCustomize\Form\Extension\AdminSearchProductTypeExtension, 
because the name is already in use  in/var/www/*****/app/Plugin/AdminProductSearchCustomize/Form/Extension/AdminSearchProductTypeExtension.php on line 0

namespace の記述が問題でした。

プラグインとして今回は作成するので、namespaceは
正: Plugin\AdminProductSearchCustomize\Form\Extension;
誤: AdminProductSearchCustomize\Form\Extension;

初歩的なことですが、他のプラグインからコピペしてしまうとあるあるですね💦

ECCUBE4は、Plugin内でController,Entity,Form,Repository,イベントと色々カスタマイズできますが、気をつけて開発したいと思います。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?