Now that in 3.1 a new dataobject is given a temporary ID, I'm wondering how to do an onBeforeWrite check to craete a new folder. I had been using.
if($this->ID != 0 && $this->FolderID == 0) {
$filter = URLSegmentFilter::create();
$folderName = $filter->filter($this->Title);
$folderExists = Folder::find_or_make('Products/'.$folderName.'/');
$this->FolderID = $folderExists->ID;
}
But now since it's craeting an Object called New Object it creates one folder called new-object then matchas all subsequent new items to it. I'm using if($this->Title 1= "New Product") but that just seems like its going to be called on every save