telosys-tools-bricks / telosys-cli

Telosys CLI - Command Line Interface
https://www.telosys.org/
GNU Lesser General Public License v3.0
166 stars 23 forks source link

Alternative to ${BASENAME}? #28

Closed georgemeng-cfwt closed 4 months ago

georgemeng-cfwt commented 4 months ago

I have one template.cfg file and multiple models, currently in templates.cfg file, I have one line of code:

dao; ${BEANNAME}DAO.cfc ; sql ; dao.vm ; *

This will generate multiple files and each file will base on the model name. But I would the file to be the database table name not the model name.

Database table is in model file:

@DbTable(resource_versions)

In this case, I would the file generated as reosurce_versionsDAO.cfc not resourceVersionsDAO.cfc.

Any solutions?

I asked the same question here https://stackoverflow.com/questions/78395741/telosys-custom-basename. Got an answer from Igu, I currently don't know how to apply the answer.

georgemeng-cfwt commented 4 months ago

Add the following code

#if ( $entity.hasDatabaseTable() )$target.forceEntityName( $entity.databaseTable )#end

At the top of .vm file, all file will be generated as expected.