public function exportToYaml($file, $dataTypes = 'all', $autoCreate = true)
{
Craft::app()->config->maxPowerCaptain();
Craft::app()->setComponent('userSession', $this);
$result = new Result();
$dataModel = $this->exportDataModel($dataTypes);
$yaml = Data::toYaml($dataModel);
if (!IOHelper::writeToFile($file, $yaml, $autoCreate)) {
// Do not auto create
$result->addError('errors', "Failed to write contents to \"{$file}\"");
}
return $result;
}