I'm going through tutorials for doctrine and have come across a problem. Does the autoload function not apply on behaviours?
This is the tutorial I've been following. It should automatically create relations between the tables mentioned upon generation, however I just get an error message saying that the respective foreign id columns do not exist in the tables.
This is the specific bit of code that should be running, but does not seem to be.
public function setTableDefinition()
{
foreach ($this->_options['relations'] as $relation) {
$columnName = Doctrine_Inflector::tableize($relation) . '_id';
if (!$this->_table->hasColumn($columnName)) {
$this->hasColumn($columnName, 'integer');
}
}
}
If I manually add the columns to my yaml schema, the behaviour works exactly as expected.
Can anyone h开发者_StackOverflow社区elp me out?
Any advice appreciated, thanks.
i think there is a typo in the example:
if (!$this->_table->hasColumn($columnName)) {
$this->hasColumn($columnName, 'integer');
}
should be
if (!$this->_table->hasColumn($columnName)) {
$this->setColumn($columnName, 'integer');
}
精彩评论