Author: mcantelon
Date: Fri Aug 31 17:20:36 2012
New Revision: 12242
Log:
Refactoring term lookups to use helper.
Modified:
trunk/lib/task/import/csvAccessionImportTask.class.php
Modified: trunk/lib/task/import/csvAccessionImportTask.class.php
==============================================================================
--- trunk/lib/task/import/csvAccessionImportTask.class.php Fri Aug 31
17:20:01 2012 (r12241)
+++ trunk/lib/task/import/csvAccessionImportTask.class.php Fri Aug 31
17:20:36 2012 (r12242)
@@ -263,14 +263,12 @@
{
if (isset($self->object) && is_object($self->object))
{
- $term_id = array_search($data, $self->getStatus('resourceTypes'));
-
- if (!$term_id)
- {
- throw new sfException('Could not find a way to handle resource
type value "'. $data .'".');
- } else {
- $self->object->resourceTypeId = $term_id;
- }
+ $self->object->resourceTypeId = $self->translateNameToTermId(
+ 'resource type',
+ $data,
+ array(),
+ $self->getStatus('resourceTypes')
+ );
}
}
});
@@ -281,14 +279,12 @@
{
if (isset($self->object) && is_object($self->object))
{
- $term_id = array_search($data, $self->getStatus('acquisitionTypes'));
-
- if (!$term_id)
- {
- throw new sfException('Could not find a way to handle acquisition
type value "'. $data .'".');
- } else {
- $self->object->acquisitionTypeId = $term_id;
- }
+ $self->object->acquisitionTypeId = $self->translateNameToTermId(
+ 'acquisition type',
+ $data,
+ array(),
+ $self->getStatus('acquisitionTypes')
+ );
}
}
});
--
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.