Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update required version to 2.0.0beta7. Refactor fieldMaps out of conf…

…ig because there seemed to be no advantage to injecting the maps, as opposed to defining the maps directly in the entity. Implement new abstract methods from AbstractEntity.
  • Loading branch information...
commit d225c6621d2c78a22bc86a796bae0ab6561a9edf 1 parent 0950e1a
@jeremiahsmall jeremiahsmall authored
View
2  composer.json
@@ -10,7 +10,7 @@
],
"require": {
"php": ">=5.3.3",
- "soliantconsulting/simplefm": ">=2.0.0beta6",
+ "soliantconsulting/simplefm": "2.0.0beta7",
"zendframework/zendframework": "2.1.4"
}
}
View
12 module/Application/Module.php
@@ -52,18 +52,14 @@ public function getServiceConfig()
return $dbAdapter;
},
'alternate_gateway_project' => function ($sm) {
- $config = $sm->get('config');
- $fieldMap = $config['sfm_field_map'];
- $entity = new \Application\Entity\Project($fieldMap);
+ $entity = new \Application\Entity\Project();
$simpleFMAdapter = $sm->get('alternate_simple_fm');
- return new \Application\Gateway\Project($fieldMap, $entity, $simpleFMAdapter);
+ return new \Application\Gateway\Project($entity, $simpleFMAdapter);
},
'alternate_gateway_task' => function ($sm) {
- $config = $sm->get('config');
- $fieldMap = $config['sfm_field_map'];
- $entity = new \Application\Entity\Task($fieldMap);
+ $entity = new \Application\Entity\Task();
$simpleFMAdapter = $sm->get('alternate_simple_fm');
- return new \Application\Gateway\Task($fieldMap, $entity, $simpleFMAdapter);
+ return new \Application\Gateway\Task($entity, $simpleFMAdapter);
},
),
);
View
51 module/Application/config/module.config.php
@@ -5,47 +5,6 @@
*/
return array(
- 'sfm_field_map' => array(
- 'Application\Entity\Project' => array(
- 'writeable' => array(
- 'projectName' => 'Project Name',
- 'description' => 'Description',
- 'tag' => 'Tag',
- ),
- 'readonly' => array(
- 'id' => 'PROJECT ID MATCH FIELD',
- 'startDate' => 'Start Date',
- 'dueDate' => 'Due Date',
- 'daysRemaining' => 'Days Remaining',
- 'daysElapsed' => 'Days Elapsed',
- 'statusOnScreen' => 'Status on Screen',
- 'createdBy' => 'Created By',
- ),
- ),
- 'Application\Entity\Task' => array(
- 'writeable' => array(
- 'taskName' => 'Task Name',
- 'description' => 'Description',
- 'tag' => 'Tag',
- ),
- 'readonly' => array(
- 'id' => 'TASK ID MATCH FIELD',
- 'startDate' => 'Start Date',
- 'dueDate' => 'Due Date',
- 'daysRemaining' => 'Days Remaining',
- 'daysElapsed' => 'Days Elapsed',
- 'status' => 'Status',
- 'statusOnScreen' => 'Status on Screen',
- 'priority' => 'Priority Number List',
- 'priorityOnScreen' => 'Priority on Screen',
- 'taskCompletionPercentage' => 'Task Completion Percentage',
- 'createdBy' => 'Created By',
- 'personnelName' => 'PERSONNEL NAME MATCH FIELD',
- 'personnelEmail' => 'Personnel::Email',
- 'personnelPhone' => 'Personnel::Phone',
- ),
- ),
- ),
'router' => array(
'routes' => array(
'home' => array(
@@ -134,17 +93,15 @@
'simple_fm' => 'Soliant\SimpleFM\ZF2\AdapterServiceFactory',
'gateway_project' => function ($sm) {
$config = $sm->get('config');
- $fieldMap = $config['sfm_field_map'];
- $entity = new \Application\Entity\Project($fieldMap);
+ $entity = new \Application\Entity\Project();
$simpleFMAdapter = $sm->get('simple_fm');
- return new \Application\Gateway\Project($fieldMap, $entity, $simpleFMAdapter);
+ return new \Application\Gateway\Project($entity, $simpleFMAdapter);
},
'gateway_task' => function ($sm) {
$config = $sm->get('config');
- $fieldMap = $config['sfm_field_map'];
- $entity = new \Application\Entity\Task($fieldMap);
+ $entity = new \Application\Entity\Task();
$simpleFMAdapter = $sm->get('simple_fm');
- return new \Application\Gateway\Task($fieldMap, $entity, $simpleFMAdapter);
+ return new \Application\Gateway\Task($entity, $simpleFMAdapter);
},
View
37 module/Application/src/Application/Entity/Project.php
@@ -36,10 +36,41 @@ class Project extends AbstractEntity
*/
protected $tasks;
- public function __construct($fieldMap, $simpleFMAdapterRow = array())
+ /**
+ * @see \Soliant\SimpleFM\ZF2\Entity\AbstractEntity::getFieldMapWriteable()
+ * @return array
+ */
+ public function getFieldMapWriteable()
+ {
+ $map = array(
+ 'projectName' => 'Project Name',
+ 'description' => 'Description',
+ 'tag' => 'Tag',
+ );
+ return $map;
+ }
+
+ /**
+ * @see \Soliant\SimpleFM\ZF2\Entity\AbstractEntity::getFieldMapReadonly()
+ * @return array
+ */
+ public function getFieldMapReadonly(){
+ $map = array(
+ 'id' => 'PROJECT ID MATCH FIELD',
+ 'startDate' => 'Start Date',
+ 'dueDate' => 'Due Date',
+ 'daysRemaining' => 'Days Remaining',
+ 'daysElapsed' => 'Days Elapsed',
+ 'statusOnScreen' => 'Status on Screen',
+ 'createdBy' => 'Created By',
+ );
+ return $map;
+ }
+
+ public function __construct($simpleFMAdapterRow = array())
{
$this->tasks = new ArrayCollection();
- parent::__construct($fieldMap, $simpleFMAdapterRow);
+ parent::__construct($simpleFMAdapterRow);
}
/**
@@ -52,7 +83,7 @@ public function unserialize()
if (!empty($this->simpleFMAdapterRow["Tasks"]["rows"])){
foreach ($this->simpleFMAdapterRow["Tasks"]["rows"] as $row){
- $this->tasks->add(new Task($this->fieldMap, $row));
+ $this->tasks->add(new Task($row));
}
}
View
44 module/Application/src/Application/Entity/Task.php
@@ -44,11 +44,49 @@ class Task extends AbstractEntity
protected $project;
/**
+ * @see \Soliant\SimpleFM\ZF2\Entity\AbstractEntity::getFieldMapWriteable()
+ * @return array
+ */
+ public function getFieldMapWriteable()
+ {
+ $map = array(
+ 'taskName' => 'Task Name',
+ 'description' => 'Description',
+ 'tag' => 'Tag',
+ );
+ return $map;
+ }
+
+ /**
+ * @see \Soliant\SimpleFM\ZF2\Entity\AbstractEntity::getFieldMapReadonly()
+ * @return array
+ */
+ public function getFieldMapReadonly(){
+ $map = array(
+ 'id' => 'TASK ID MATCH FIELD',
+ 'startDate' => 'Start Date',
+ 'dueDate' => 'Due Date',
+ 'daysRemaining' => 'Days Remaining',
+ 'daysElapsed' => 'Days Elapsed',
+ 'status' => 'Status',
+ 'statusOnScreen' => 'Status on Screen',
+ 'priority' => 'Priority Number List',
+ 'priorityOnScreen' => 'Priority on Screen',
+ 'taskCompletionPercentage' => 'Task Completion Percentage',
+ 'createdBy' => 'Created By',
+ 'personnelName' => 'PERSONNEL NAME MATCH FIELD',
+ 'personnelEmail' => 'Personnel::Email',
+ 'personnelPhone' => 'Personnel::Phone',
+ );
+ return $map;
+ }
+
+ /**
* @param array $simpleFMAdapterRow
*/
- public function __construct($fieldMap, $simpleFMAdapterRow = array())
+ public function __construct($simpleFMAdapterRow = array())
{
- parent::__construct($fieldMap, $simpleFMAdapterRow);
+ parent::__construct($simpleFMAdapterRow);
}
/**
@@ -60,7 +98,7 @@ public function unserialize()
parent::unserialize();
if (!empty($this->simpleFMAdapterRow["Projects"]["rows"])){
- $this->project = new Project($this->fieldMap, $this->simpleFMAdapterRow["Projects"]["rows"][0]);
+ $this->project = new Project($this->simpleFMAdapterRow["Projects"]["rows"][0]);
}
return $this;
Please sign in to comment.
Something went wrong with that request. Please try again.