2017-11-09 3 views
0

Ich habe versuchen Drop-Down zu binden und unter Code in meinem OrganizationBundle-> form-> Tyep-> OrganizationType.php Datei hinzufügen:Symfony 2.8 Bind Dropdown Propel mit

use Admin\SalesTeamBundle\Model\SalesTeam; 
use Admin\SalesTeamBundle\Model\SalesTeamQuery; 
use Admin\SalesTeamBundle\Form\Type\SalesTeamType; 

public function buildForm(FormBuilderInterface $builder, array $options) 
{ 
    $builder->add('salesTeamId', 'model' , array( 
     'class' => 'Admin\SalesTeamBundle\Model\SalesTeam', 
     'required' => true, 
     'multiple' => false, 
     'expanded' => false, 
     'label' => 'Sales Team', 
     'query' => SalesTeamQuery::create()->orderByName(), 
     'property' => 'name', 
    )); 
} 

Und ich bekomme diese Fehlermeldung:

The type name specified for the service "propel.form.type.model" does not match the actual name. Expected "model", given "Propel\Bundle\PropelBundle\Form\Type\ModelType"

Wie kann ich dieses Problem beheben?

Antwort

0

sollten Sie ModelType::class anstelle von model

$builder->add('salesTeamId', ModelType::class , array( 
     [...] 
    ));