CodeIgniter 1.7.3、Datamapper DMZ 1.7.1 (いいえ、アップグレードはオプションではありません)、MySQL 5.1、および構築中のアプリケーション用のCron Job Boosttrapperを実行しています。XML ファイルから情報を抽出してデータベースに保存しようとしています。データの取得は、データベースからのデータの取得と同様に問題なく機能するため、データベース接続や XML ファイルの問題ではないことがわかります。
$this->site = $this->site->get_by_short_name('site');
//Load the XML files into variables so we can do stuff with them.
$doctors = simplexml_load_file(realpath('../xml/doctors.xml'));
foreach ($doctors->children() as $doctor) {
$dr = new Doctor();
$attrs = $doctor->attributes();
/* See if the Doctor already exists. If so, update it.
* Datamapper won't update fields that don't change, so if nothing's
* changed, then the DB call won't be made.
*/
$dr->get_by_drkey($attrs['Key']);
$dr->drkey = $attrs['Key'];
$dr->first_name = $doctor->FirstName;
$dr->middle_name = $doctor->MiddleName;
$dr->last_name = $doctor->LastName;
$dr->long_name = $doctor->LongName;
$dr->degrees = $doctor->Degrees;
$dr->pic = $doctor->ImageURL;
$dr->save($this->site);
}
の戻り値を確認した$dr->save($this->site)
ところ、true (「保存に成功しました」) が返されましたが、データは保存されておらず、エラーもありません。私は関係なしで試しました(データベースでの要件を削除しました)ので、エラーなしで保存されるはずですが、それでも保存されません。モデルの関係設定も再確認しましたが、問題ありません。
また、Datamapper をバイパスし$this->db->insert('doctors',$data)
て、配列に変換されたデータでストレートを実行しようとしましたが、データはまだ保存されません。コマンドラインからの実行に問題があるかどうかを確認するために、ブラウザーから (ブートストラップをバイパスして) 実行しようとしましたが、それも機能しませんでした。また、セッションまたは認証ライブラリを自動ロードしないため、ブートストラップに関する既知の問題はトリガーされません。
なぜこれが機能しないのかについての洞察を持っている人はいますか?