public static function toYaml(array $data)
{
$data = $data === null ? null : new static($data);
return Yaml::dump($data->attributes, 12, 2);
}
/** * Export to Yaml file. * * @param string $file * @param bool $autoCreate * * @return Result */ public function exportToYaml($file, $autoCreate = true) { Craft::app()->config->maxPowerCaptain(); $result = new Result(); $dataModel = $this->exportDataModel(); $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; }