Author: mcantelon
Date: Wed Jan 18 11:38:56 2012
New Revision: 10711
Log:
Replaced weird way of doing things with standard OO way.
Modified:
trunk/lib/QubitFlatfileImport.class.php
Modified: trunk/lib/QubitFlatfileImport.class.php
==============================================================================
--- trunk/lib/QubitFlatfileImport.class.php Wed Jan 18 00:03:25 2012
(r10710)
+++ trunk/lib/QubitFlatfileImport.class.php Wed Jan 18 11:38:56 2012
(r10711)
@@ -27,37 +27,31 @@
*/
class QubitFlatfileImport
{
+ public $className;
+ public $errorLog;
+ public $rowsUntilProgressDisplay;
+
+ public $status = array();
+
+ public $columnNames = array();
+ public $ignoreColumns = array();
+
+ public $standardColumns = array();
+ public $columnMap = array();
+ public $propertyMap = array();
+ public $noteMap = array();
+ public $handlers = array();
+ public $variableColumns = array();
+ public $arrayColumns = array();
+
+ public $rowInitLogic;
+ public $preSaveLogic;
+ public $saveLogic;
+ public $postSaveLogic;
+
public function __construct($options)
{
- $this->status = array();
- $this->standardColumns = array();
- $this->columnMap = array();
- $this->propertyMap = array();
- $this->noteMap = array();
- $this->handlers = array();
- $this->variableColumns = array();
- $this->arrayColumns = array();
-
- $allowedProperties = array(
- 'errorLog',
- 'className',
- 'rowInitLogic',
- 'rowsUntilProgressDisplay',
- 'status',
- 'ignoreColumns',
- 'columnNames',
- 'preSaveLogic',
- 'postSaveLogic',
- 'saveLogic',
- 'propertyMap',
- 'noteMap',
- 'columnMap',
- 'standardColumns',
- 'variableColumns',
- 'arrayColumns'
- );
-
- $this->setPropertiesFromArray($this, $options, $allowedProperties);
+ $this->setPropertiesFromArray($this, $options, TRUE);
// initialize bookkeeping of rows processed
$this->status['rows'] = 0;
@@ -80,7 +74,7 @@
*
* @param object &$object object to act upon
* @param array $propertyArray array of properties and their respective
values
- * @param array $allowedProperties array of properties that can be set
+ * @param array $allowedProperties array of properties that can be set or
TRUE if any allowed
* @param array $ignore array of properties that should be ignored
*
* @return void
@@ -92,7 +86,11 @@
{
if (!in_array($option, $ignore))
{
- if (in_array($option, $allowedProperties))
+ $settingAllowed = (
+ ($allowedProperties === TRUE && property_exists(get_class($object),
$option))
+ || (is_array($allowedProperties) && in_array($option,
$allowedProperties))
+ );
+ if ($settingAllowed)
{
$object->$option = $value;
}
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.