Hallo,
ich habe eine M:N Beziehung aufgestellt, die auch soweit funktioniert bis auf die findAllByAttributes - Methode.
Meine relation
cars - Modell
public function relations()
{
return array(
'drivers' => array(self::MANY_MANY, 'drivers', 'cars_drivers(carsId, driversId)',
'together' => true,
'joinType' => 'INNER JOIN',
),
}
Zugriff von außen:
$x = cars::model()->with('drivers')->findAllByAttributes( array('drivers.baseform' => 'John'));
Fehler-Stack
exception 'CDbException' with message 'Tabelle "cars" hat kein Feld namens "drivers.baseform".'
in D:\Workspace\yii\framework\db\schema\CDbCommandBuilder.php:496 Stack trace:
#0 D:\Workspace\yii\framework\db\ar\CActiveFinder.php(151): CDbCommandBuilder->createColumnCriteria(Object(CMysqlTableSchema), Array, '', Array)
#1 D:\Workspace\blog2\protected\models\suche.php(50): CActiveFinder->findAllByAttributes(Array)
#2 D:\Workspace\blog2\protected\controllers\TranslationController.php(257): suche->engine('John')
#3 D:\Workspace\yii\framework\web\actions\CInlineAction.php(32): ListingController->actionIndex()
#4 D:\Workspace\yii\framework\web\CController.php(300): CInlineAction->run()
#5 D:\Workspace\yii\framework\web\CController.php(278): CController->runAction(Object(CInlineAction))
#6 D:\Workspace\yii\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#7 D:\Workspace\yii\framework\web\CWebApplication.php(310): CController->run('phrase')
#8 D:\Workspace\yii\framework\web\CWebApplication.php(120): CWebApplication->runController('listing/inde...')
#9 D:\Workspace\yii\framework\base\CApplication.php(135): CWebApplication->processRequest()
#10 D:\Workspace\blog2\index.php(11): CApplication->run()