[eluser]IgnitedCoder[/eluser]
Make sure your table has an id field of type int and that its set to auto increment/primary key. Remember the table name is plural and the Model is singular.
Code:
CREATE TABLE `tests` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`thetext` varchar(200) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
Model
Code:
class Test extends DataMapper {
}
Controller
Code:
$test = new Test();
$test->thetext = 'test it';
$test->save();
echo $test->id;