silverstripe/silverstripe-framework — pull request #2096 by CheeseSucker (2013-06-14 16:33:17+00:00)
Title: ENHANCEMENT: Allow programmers to set OwnerID for new files.

**NOTE:** This change should be reviewed to make sure it does not cause any side effects.

**Example use case:** An admin porting user images from an old website.
The script would put the images in the assets folder, and then insert them into the database using Image::write() and data from the old database.

```php
public function insertImage($data) {
$image = new Image();
$image->ParentID = $data->parentId;
$image->Title = $data->title;
$image->FileName = $data->filename;
$image->OwnerID = $data->ownerId;
$image->write();

// In the current version, this results in all images
// being owned by Member::currentUser() instead of
// the expected $data->ownerId;
}
```