public function bakeEntity($model, array $data = [])
{
if (!empty($this->params['no-entity'])) {
return null;
}
$name = $this->_entityName($model->alias());
$namespace = Configure::read('App.namespace');
$pluginPath = '';
if ($this->plugin) {
$namespace = $this->_pluginNamespace($this->plugin);
$pluginPath = $this->plugin . '.';
}
$data += ['name' => $name, 'namespace' => $namespace, 'plugin' => $this->plugin, 'pluginPath' => $pluginPath, 'primaryKey' => []];
$this->BakeTemplate->set($data);
$out = $this->BakeTemplate->generate('Model/entity');
$path = $this->getPath();
$filename = $path . 'Entity' . DS . $name . '.php';
$this->out("\n" . sprintf('Baking entity class for %s...', $name), 1, Shell::QUIET);
$this->createFile($filename, $out);
$emptyFile = $path . 'Entity' . DS . 'empty';
$this->_deleteEmptyFile($emptyFile);
return $out;
}