2017-01-24 8 views
2

をロードできませんでした、(私はバンドルを上書きするためのマニュアルの指示に従ったが、私は/レジスタの中に/ログイン作品にアクセスしようとしたとき、私はこのエラーを取得するI )それを上書きしませんでした:FOSUserBundleが登録を上書きしますが、私はFOSUserBundleを使用しようとしたタイプのエラー

Could not load type "app_user_registration" 
500 Internal Server Error - InvalidArgumentException 

構成

symfonyのバージョン:3.1.7

FOSUserBundleバージョン:DEV-マスター

マイファイル/設定/ services.yml

アプリ:

services: 
    app.form.registration: 
     class: CoreBundle\Form\Type\RegistrationFormType 
     tags: 
      - { name: form.type, alias: app_user_registration } 

アプリ/設定/ config.yml:

fos_user: 
    db_driver: orm 
    firewall_name: main 
    user_class: CoreBundle\Entity\User 
    registration: 
     form: 
      type: app_user_registration 

のsrc/CoreBundle /Form/Type/RegistrationFormType.php

<?php 
// src/CoreBundle/Form/Type/RegistrationFormType.php 

namespace CoreBundle\Form\Type; 

use Symfony\Component\Form\AbstractType; 
use Symfony\Component\Form\FormBuilderInterface; 

class RegistrationFormType extends AbstractType 
{ 
    public function buildForm(FormBuilderInterface $builder, array $options) 
    { 
     $builder->add('name'); 
    } 

    public function getParent() 
    { 
     return 'fos_user_registration'; 
    } 

    public function getName() 
    { 
     return 'app_user_registration'; 
    } 
} 
?> 

のsrc/viwa/UserBundle /コントローラー/ RegistrationController.php:

<?php 
// src/viwa/UserBundle/Controller/RegistrationController.php 

namespace viwa\UserBundle\Controller; 

use Symfony\Component\HttpFoundation\RedirectResponse; 
use FOS\UserBundle\Controller\RegistrationController as BaseController; 

class RegistrationController extends BaseController 
{ 
    // Don't need to change this right now. 
} 
?> 

のsrc/viwa/UserBundle/viwaUserBundle.php:あなたが私に私を助けるために他の何かを必要とする場合

<?php 
// src/viwa/UserBundle/viwaUserBundle.php 

namespace viwa\UserBundle; 

use Symfony\Component\HttpKernel\Bundle\Bundle; 

class viwaUserBundle extends Bundle 
{ 
    public function getParent() 
    { 
     return 'FOSUserBundle'; 
    } 
} 

私の投稿を編集する。

は、誰もが私を助けることができます願っています。

+1

、代わりにエイリアスapp_user_resitrationを使用しての、CoreBundle \フォーム\タイプ\ RegistrationFormTypeを使用しています。 CoreBundle/Form/Type/RegistrationFormTypeのgetParent()は、 '' FOS \ UserBundle \ Form \ Type \ RegistrationFormType 'を返します。もっと見ることがあれば、もう一度コメントします – pogeybait

答えて

3

あなたconfig.ymlファイルは次のようになります。

あなた src/CoreBundle/Form/Type/RegistrationFormType.php
fos_user: 
    db_driver: orm 
    firewall_name: main 
    user_class: CoreBundle\Entity\User 
    registration: 
     form: 
      type: CoreBundle\Form\Type\RegistrationFormType 

getParent()機能は次のようになります。

public function getParent() 
{ 
    return 'FOS\UserBundle\Form\Type\RegistrationFormType'; 
} 
+0

ありがとう!これは私の問題を解決しましたが、私はなぜそれを理解できませんか? symfonyのドキュメントでは良い提案だ – Angelo

1

あなたは、おそらく '現在の1.3.x /' のドキュメントを読んでいますデフォルトで開いています。 '2.0/master'に切り替えると、正しいバージョンのドキュメントが表示されます。

あなたconfig.ymlで
+0

これらの場所には、名前空間はありませんが、あなたもあなたの答えで問題の解決策が含まれている場合はここに来て、将来のユーザーのために、それが役立つかもしれません。 – mickadoo

関連する問題