summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2016-01-30 20:12:31 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2016-01-30 20:12:31 +0100
commitb8a9467f8da780bf6a83d3b6765187dbfc897086 (patch)
treedbaa3b0c469ec723ee7d234ae7ccd0bbc6089d30
parentfaa83d57eeb830e5557a1eb8bcd52348d0bdfcbc (diff)
downloadextbase-generator-cli-b8a9467f8da780bf6a83d3b6765187dbfc897086.tar.gz
extbase-generator-cli-b8a9467f8da780bf6a83d3b6765187dbfc897086.tar.bz2
extbase-generator-cli-b8a9467f8da780bf6a83d3b6765187dbfc897086.zip
Add support for TCA files named by the tablename
-rwxr-xr-xadd_extbase_property.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/add_extbase_property.sh b/add_extbase_property.sh
index b8faa0b..8701c8b 100755
--- a/add_extbase_property.sh
+++ b/add_extbase_property.sh
@@ -11,13 +11,18 @@ property=$2
#typ=int
typ=$3
+extension=$(basename `pwd`)
+extension_normalize=`echo "$extension" | sed 's/_//g'`
+model_normalize=`echo "$model" | tr '[:upper:]' '[:lower:]'`
+tablename="tx_${extension_normalize}_domain_model_${model_normalize}"
+
model_file=Classes/Domain/Model/${model}.php
-tca_file=Configuration/TCA/${model}.php
+tca_file=Configuration/TCA/${tablename}.php
+
+[[ -e "$tca_file" ]] || tca_file=Configuration/TCA/${model}.php
# TODO: search backwards for ext_emconf.php and cd to that directory and use it as extension name
# TODO: fail if ext_emconf.php is not found (probably the wrong directory)
-extension=$(basename `pwd`)
-tablename=$(sed -n "s/^\$GLOBALS\['TCA'\]\['\([^']*\)'].*/\1/p" $tca_file)
field=`echo $property | sed -r 's/([a-z]+)([A-Z][a-z]+)/\1_\l\2/g'`
uproperty=`echo $property | sed -r 's/^./\u&/'`