The "Types" model has no "Situation" relation

Asked

Viewed 38 times

1

Opa, I’m trying to make a relationship between two tables but is returning me this error, above. I have no idea what is wrong.

this is my YAML structure:

Tipos_denuncias:
 connection: doctrine
 tableName: tipos_denuncias
 columns:
 situacao:
  type: integer(8)
  readonly: false
  notnull: false
  comment: Situacao
  extra: { label: Situacao, tooltip: Informe a situação da denúncia. } 
 relations:
   Situacao:
   Class: Situacoes
   foreignAlias: Situacao
   local: situacao
   foreign: id
   type: one
   foreignType: many

   Situacoes:
    connection: doctrine
    tableName: situacoes
    columns:
           id:
            type: integer(8)
            primary: true
            readonly: true
            autoincrement: true
           descricao:
            type: varchar(10)
            readonly: false
            notnull: true
            comment: Descrição
            extra: { label: Descrição, tooltip: Descrição da Situação. }

and that’s my Symfony structure:

public function configure()
{
  $this->widgetSchema['situacao'] = new sfWidgetFormDoctrineChoice( array('label' => 'Situacao', 'method' => 'getSituacao', 'extra' => array("label" => "Situacao", "tooltip" => "Informe a situação da denúncia."), 'model' => $this->getRelatedModelName('Situacao'), 'order_by' => array("descricao", "asc"), 'add_empty' => ''));
 }

You’re making a mistake in Alias, but I think you’re right. Can anyone see a mistake?

  • In which namespace your entities are contained?

  • Dude, I don’t think it’s on any. The system was already set up just for maintenance, or, Be clearer with your question.

  • Open the class Situacoes and look at the namespace it’s in. It’s the first line of code.

  • in Situacoes.class.php: class Situacoes extends Basesituacoes { }

  • So your class is in global namespace. What I suspect is that in the Type class there is no attribute referencing the entity Situation, or the attribute is with the wrong name.

  • Exactly, I’m not managing to make the foreign key reference on symfony. In the database I made the reference, in the file schemas.yml for the tables configuration I made the reference too, but I noticed that in the file schemas.sql within data>sql, there is my alter table containing the addition of the foreign key in the table types. I’m trying to figure out the mistake yet.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.