/** * Write the actual TableName.php file. * * @param $table * @param Model $model * * @throws Exception * * @return array */ 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]; }
/** * Check if we have a hidden field. * * @param $field * * @return bool */ protected function isHidden($field) { if (StringUtils::strContains(['hidden', 'secret'], $field->Comment)) { return true; } return false; }