forked from hechoendrupal/drupal-console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEntityConfigGenerator.php
More file actions
76 lines (66 loc) · 2.13 KB
/
Copy pathEntityConfigGenerator.php
File metadata and controls
76 lines (66 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @file
* Contains \Drupal\AppConsole\Generator\EntityGenerator.
*/
namespace Drupal\AppConsole\Generator;
class EntityConfigGenerator extends Generator
{
/**
* Generator Entity
*
* @param string $module Module name
* @param string $entity_name Entity machine name
* @param string $entity_class Entity class name
*/
public function generate($module, $entity_name, $entity_class)
{
$parameters = [
'module' => $module,
'entity_name' => $entity_name,
'entity_class' => $entity_class,
];
$this->renderFile(
'module/config/schema/entity.schema.yml.twig',
$this->getModulePath($module) . '/config/schema/' . $entity_name . '.schema.yml',
$parameters
);
$this->renderFile(
'module/routing-entity.yml.twig',
$this->getModulePath($module) . '/' . $module . '.routing.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/links.action-entity.yml.twig',
$this->getModulePath($module) . '/' . $module . '.links.action.yml',
$parameters,
FILE_APPEND
);
$this->renderFile(
'module/src/interface-entity.php.twig',
$this->getSourcePath($module) . '/' . $entity_class . 'Interface.php',
$parameters
);
$this->renderFile(
'module/src/Entity/entity.php.twig',
$this->getEntityPath($module) . '/' . $entity_class . '.php',
$parameters
);
$this->renderFile(
'module/src/Form/entity.php.twig',
$this->getFormPath($module) . '/' . $entity_class . 'Form.php',
$parameters
);
$this->renderFile(
'module/src/Form/entity-delete.php.twig',
$this->getFormPath($module) . '/' . $entity_class . 'DeleteForm.php',
$parameters
);
$this->renderFile(
'module/src/Controller/entity-listbuilder.php.twig',
$this->getControllerPath($module) . '/' . $entity_class . 'ListBuilder.php',
$parameters
);
}
}