1 | <?php |
||
8 | class DefaultNamingStrategy implements NamingStrategyInterface |
||
9 | { |
||
10 | private $beanPrefix = ''; |
||
11 | private $beanSuffix = ''; |
||
12 | private $baseBeanPrefix = 'Abstract'; |
||
13 | private $baseBeanSuffix = ''; |
||
14 | private $daoPrefix = ''; |
||
15 | private $daoSuffix = 'Dao'; |
||
16 | private $baseDaoPrefix = 'Abstract'; |
||
17 | private $baseDaoSuffix = 'Dao'; |
||
18 | |||
19 | /** |
||
20 | * Sets the string prefix to any bean class name. |
||
21 | * |
||
22 | * @param string $beanPrefix |
||
23 | */ |
||
24 | public function setBeanPrefix(string $beanPrefix) |
||
28 | |||
29 | /** |
||
30 | * Sets the string suffix to any bean class name. |
||
31 | * |
||
32 | * @param string $beanSuffix |
||
33 | */ |
||
34 | public function setBeanSuffix(string $beanSuffix) |
||
38 | |||
39 | /** |
||
40 | * Sets the string prefix to any base bean class name. |
||
41 | * |
||
42 | * @param string $baseBeanPrefix |
||
43 | */ |
||
44 | public function setBaseBeanPrefix(string $baseBeanPrefix) |
||
48 | |||
49 | /** |
||
50 | * Sets the string suffix to any base bean class name. |
||
51 | * |
||
52 | * @param string $baseBeanSuffix |
||
53 | */ |
||
54 | public function setBaseBeanSuffix(string $baseBeanSuffix) |
||
58 | |||
59 | /** |
||
60 | * Sets the string prefix to any DAO class name. |
||
61 | * |
||
62 | * @param string $daoPrefix |
||
63 | */ |
||
64 | public function setDaoPrefix(string $daoPrefix) |
||
68 | |||
69 | /** |
||
70 | * Sets the string suffix to any DAO class name. |
||
71 | * |
||
72 | * @param string $daoSuffix |
||
73 | */ |
||
74 | public function setDaoSuffix(string $daoSuffix) |
||
78 | |||
79 | /** |
||
80 | * Sets the string prefix to any base DAO class name. |
||
81 | * |
||
82 | * @param string $baseDaoPrefix |
||
83 | */ |
||
84 | public function setBaseDaoPrefix(string $baseDaoPrefix) |
||
88 | |||
89 | /** |
||
90 | * Sets the string suffix to any base DAO class name. |
||
91 | * |
||
92 | * @param string $baseDaoSuffix |
||
93 | */ |
||
94 | public function setBaseDaoSuffix(string $baseDaoSuffix) |
||
98 | |||
99 | |||
100 | /** |
||
101 | * Returns the bean class name from the table name (excluding the namespace). |
||
102 | * |
||
103 | * @param string $tableName |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getBeanClassName(string $tableName): string |
||
110 | |||
111 | /** |
||
112 | * Returns the base bean class name from the table name (excluding the namespace). |
||
113 | * |
||
114 | * @param string $tableName |
||
115 | * @return string |
||
116 | */ |
||
117 | public function getBaseBeanClassName(string $tableName): string |
||
121 | |||
122 | /** |
||
123 | * Returns the name of the DAO class from the table name (excluding the namespace). |
||
124 | * |
||
125 | * @param string $tableName |
||
126 | * @return string |
||
127 | */ |
||
128 | public function getDaoClassName(string $tableName): string |
||
132 | |||
133 | /** |
||
134 | * Returns the name of the base DAO class from the table name (excluding the namespace). |
||
135 | * |
||
136 | * @param string $tableName |
||
137 | * @return string |
||
138 | */ |
||
139 | public function getBaseDaoClassName(string $tableName): string |
||
143 | |||
144 | /** |
||
145 | * Tries to put string to the singular form (if it is plural) and camel case form. |
||
146 | * We assume the table names are in english. |
||
147 | * |
||
148 | * @param $str string |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | private static function toSingularCamelCase(string $str): string |
||
164 | |||
165 | /** |
||
166 | * Returns the class name for the DAO factory. |
||
167 | * |
||
168 | * @return string |
||
169 | */ |
||
170 | public function getDaoFactoryClassName(): string |
||
174 | } |
||
175 |