protected function writeFile($table, $model)
    {
        $filename = StringUtils::prettifyTableName($table, $this->prefix).'.php';

        if (!is_dir($this->path)) {
            $oldUMask = umask(0);
            echo 'creating path: '.$this->path.LF;
            mkdir($this->path, 0777, true);
            umask($oldUMask);
            if (!is_dir($this->path)) {
                throw new Exception('dir '.$this->path.' could not be created');
            }
        }
        $result = file_put_contents($this->path.'/'.$filename, $model);

        return ['filename' => $this->path.'/'.$filename, 'result' => $result];
    }