I'm having a slightly weird problem. I'm trying to create a dataobject that will appear as a page in the site tree.
The basic code is like this:
$product = new Product();
$product->Title = "Example";
$product->ProductNumber = 666;
If I do that and then go and watch the site tree everything looks all peachy. The new product has been added as a new published page.
But if I have a look in the database tables I realize that while the Product draft table looks like its intended to all fields except the ID field in the Product_Live table is set to NULL.
So if I do a:
DataObject::get_one("Product", "ProductNumber = '666'");
It will return nothing as ProductNumber is NULL in the _Live table.