Fixed: Custom Controller. Insert Sometimes Works

Permalink
I have a simple model setup that just extends model and I'm trying to get it to insert into the database. It seems to work sometimes and not others. Here's my controller with the AdoDBActiveRecord call.

<?php
Loader::model('concert');  
class DashboardBoxOfficeController extends Controller {
    public function on_start() {
   $concert = new Concert();
   $concert->concertName = 'Nitty Gritty Dirt Band';
   $concert->ticketPurchaseLimit = 10;
   $concert->onSaleDate = date('Y-m-d h:i:s', time());
   $concert->concertDate = date('Y-m-d', time());
   $concert->save();
    }
}


One minute it'll insert a new record and the next it'll throw this error: mysql error: [-9999: Input Array does not match ?: INSERT INTO Concerts(concertId,concertName,ticketPurchaseLimit,onSaleDate,concertDate) VALUES (] in Execute(, )

Any help would be greatly appreciated.

CodeMonkey
 
CodeMonkey replied on at Permalink Reply
CodeMonkey
I just noticed the comments in the file set model.

I needed to explicitly set the primary key field to null. BRUTES AdoDBActiveRecord, BRUTES I say!