/** * Used by the sync task * * @param string $path * @return \DNProject */ public static function create_from_path($path) { $project = new DNProject(); $project->Name = $path; $project->write(); // add the administrators group as the viewers of the new project $adminGroup = Group::get()->filter('Code', 'administrators')->first(); if ($adminGroup && $adminGroup->exists()) { $project->Viewers()->add($adminGroup); } return $project; }