From 46bf8115baf309b6bc2bf3701c687c533ccdbd5f Mon Sep 17 00:00:00 2001 From: baylagas Date: Wed, 3 Mar 2021 22:39:19 -0600 Subject: [PATCH 1/2] added company cfm, another composition example --- Ortus-Folder/Composition/Company.cfc | 29 ++++++++++++++++++++++++++++ Ortus-Folder/Composition/index.cfm | 14 +++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Ortus-Folder/Composition/Company.cfc diff --git a/Ortus-Folder/Composition/Company.cfc b/Ortus-Folder/Composition/Company.cfc new file mode 100644 index 0000000..66f3c51 --- /dev/null +++ b/Ortus-Folder/Composition/Company.cfc @@ -0,0 +1,29 @@ +component accessors="true" +{ + property name="name"; + property name="yearFounded"; + property name="departmentArray" type="array"; + + public any function init(pName, pYearFounded) + { + setName(arguments.pName); + setYearFounded(arguments.pYearFounded); + setDepartmentArray(arrayNew(1)); + + return this; + } + + public function showCompanyInfo(){ + writeOutput("

name: #getName()#

"); + writeOutput("

year founded: #getYearFounded()#

"); + writeOutput("

department list:

"); + + for (department in getDepartmentArray()){ + department.showDepartmentInfo(); + } + } + + public function addDepartment(pDeparment){ + getDepartmentArray().append(pDeparment); + } +} \ No newline at end of file diff --git a/Ortus-Folder/Composition/index.cfm b/Ortus-Folder/Composition/index.cfm index 3ab4aff..c4adbb9 100644 --- a/Ortus-Folder/Composition/index.cfm +++ b/Ortus-Folder/Composition/index.cfm @@ -16,4 +16,16 @@ - \ No newline at end of file + + + + + + + + + + + + + \ No newline at end of file From 0c4c91ff01237ecdd49ac552bc7b7c0637eb9db2 Mon Sep 17 00:00:00 2001 From: baylagas Date: Wed, 3 Mar 2021 22:47:43 -0600 Subject: [PATCH 2/2] test --- Ortus-Folder/Composition/Company.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ortus-Folder/Composition/Company.cfc b/Ortus-Folder/Composition/Company.cfc index 66f3c51..afdbb2d 100644 --- a/Ortus-Folder/Composition/Company.cfc +++ b/Ortus-Folder/Composition/Company.cfc @@ -9,7 +9,7 @@ component accessors="true" setName(arguments.pName); setYearFounded(arguments.pYearFounded); setDepartmentArray(arrayNew(1)); - + return this; }