CDbFixtureManager无法正确初始化

Bug位置:CDbFixtureManager::prepare()

受影响版本:1.1.0,1.1.1

原始代码:

119行 foreach($this->getFixtures() as $fixture)

120行 $this->loadFixture($fixture);

正确代码:

119行 foreach($this->getFixtures() as $tableName => $fixture)

120行 $this->loadFixture($tableName);

描述:配置了fixture元件以后,当使用Yii::app()->fixture访问该元件时,系统并没有插入tests/fixtures目录下的原始记录.

希望老大确认该Bug是否存在,谢谢.

另外还想问一下在YII的官方文档里好像有说到当首次访问Yii::app()->fixture元件时,系统会截断(truncating)tests/fixtures目录下对应的数据库表,但是好像源代码只进行了插入记录的操作而没有截断数据库表和恢复表主键顺序值,请问是不是还没有实现截断数据库表和恢复主键顺序值的功能?原文描述如下:

When CDbFixtureManager is referenced for the first time, it will go through every fixture file and use it to reset the corresponding table. It resets a table by truncating the table, resetting the sequence value for the table’s auto-incremental primary key, and then inserting the rows of data from the fixture file into the table.

因为$this->getFixtures()获取的数据格式如下:

Array (

[$tableName] => $filePath

)

例子:

Array (

[Post] => D:\web\member\protected\tests\fixtures\Post.php

)

我在fixture目录下建了一个feed.php对应feed表,但是CDbFixtureManager似乎根本没有被执行。

加了init.php也没有被执行,不知是什么原因?




echo __FILE__.':'.__LINE__.' <pre>';print_r('');echo '</pre>';exit;

include 'feed.php';



Just an off-topic note. It would be very nice if you could use English in this forum, so other readers can take a part in your discussion. This is especially important, as your are discussing some bugs in Yii. If I’m not mistaken, all forums except Yii International are in general English-only forums. Thank you.