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?
– Rodrigo Rigotti
Dude, I don’t think it’s on any. The system was already set up just for maintenance, or, Be clearer with your question.
– Estácio Di Fabio
Open the class
Situacoes
and look at the namespace it’s in. It’s the first line of code.– Rodrigo Rigotti
in Situacoes.class.php: class Situacoes extends Basesituacoes { }
– Estácio Di Fabio
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.
– Rodrigo Rigotti
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.
– Estácio Di Fabio