Hi I get the following error when rebuilding the database in tutorial 2 after adding the db fields in the ArticlePage.php class
Building Database
Creating database tables
PageComment
SiteTree
Email_BounceRecord
QueuedEmail
File
Group
LoginAttempt
Member
MemberPassword
Permission
Widget
WidgetArea
Page
GhostPage
ArticleHolder
ArticlePage
Table ArticlePage: created
[Notice] Undefined index: ArticlePage
GET /silverstripe/dev/build?flush=1
Line 352 in C:\wamp\www\SilverStripe\sapphire\core\model\Database.php
Source
343
344 if(!$newTable && !isset($this->fieldList[$table])) {
345 $this->fieldList[$table] = $this->fieldList($table);
346 }
347
348 if(is_array($spec))
349 $specValue=$spec['data_type'];
350 else $specValue=$spec;
351
352 if(is_array($this->fieldList[$table][$field]))
353 $fieldValue=$this->fieldList[$table][$field]['data_type'];
354 else $fieldValue=$this->fieldList[$table][$field];
355
356 if(is_array($spec_orig))
357 $spec_orig=DB::getConn()->$spec_orig['type']($spec_orig['parts']);
358
Trace
Notice: Undefined offset: 0 in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 520
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 557
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 557
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 557
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 557
Warning: Invalid argument supplied for foreach() in C:\wamp\www\SilverStripe\sapphire\dev\Debug.php on line 557
AAA()
Line A of A
III()
Line I of I
iii()
Line i of i
iii()
Line i of i
iii()
Line i of i
If I comment out the entries for db
<?php
/**
* Defines the ArticlePage page type
*/
class ArticlePage extends Page {
static $db = array(
/* 'Date' => 'Date',
'Author' => 'Text'*/
);
static $has_one = array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new CalendarDateField('Date'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content');
return $fields;
}
}
class ArticlePage_Controller extends Page_Controller {
}
?>
Then the error goes away. I'm using the latest svn trunk (http://svn.silverstripe.com/open/phpinstaller/trunk) and wamp on windows xp.
Any ideas as to what's causing this?
Regards,
Martin.