I've got a manually-written spreadsheet that lists the filenames to import. It would be handy to have a MigrateList class that takes a CSV as input for this sort of scenario. Patch coming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim created an issue. See original summary.

joachim’s picture

Status: Active » Needs review
FileSize
4.06 KB
T-lo’s picture

Very pleased to find someone had already implemented this, I think it's a really good addition to the standard set.

I had to make some updates to get this working as specified for CSV with header rows and using header rows as keys.

darrenwh’s picture

Some observations

  1. +++ b/plugins/sources/csv.inc
    @@ -6,6 +6,173 @@
    +   * @var integer
    

    Needs a parameter comment

  2. +++ b/plugins/sources/csv.inc
    @@ -6,6 +6,173 @@
    +    // fgetcsv specific options
    ...
    +   * @return string
    

    Missing period. Needs to be capitalised

  3. +++ b/plugins/sources/csv.inc
    @@ -6,6 +6,173 @@
    +   * @return string
    ...
    +   */
    

    Needs a return comment

  4. +++ b/plugins/sources/csv.inc
    @@ -6,6 +6,173 @@
    +   */
    

    Needs a return type and comment

  5. +++ b/plugins/sources/csv.inc
    @@ -6,6 +6,173 @@
    +
    

    Missing doc block

T-lo’s picture

FileSize
1.43 KB
darrenwh’s picture

Further observations

  1. +++ b/plugins/sources/csv.inc
    @@ -34,6 +34,13 @@
    +   */
    

    Missing variable comment.

  2. +++ b/plugins/sources/csv.inc
    @@ -141,12 +156,16 @@
    +    // Key the array with the headers
    

    Missing period at end of comment.

T-lo’s picture

Assigned: Unassigned » T-lo
Status: Needs review » Needs work
T-lo’s picture

I haven't capitalised "// fgetcsv specific options." as fgetcsv is a function name.
Sorted the rest of these code style issues.

(Also this was copied from the matching JSON function which is already in the module.)

T-lo’s picture

Status: Needs work » Needs review
darrenwh’s picture

+++ b/plugins/sources/csv.inc
@@ -6,6 +6,181 @@
+    parent::__construct();

Constructers should only really be used for defining class variables, could the functionality below 66 be moved into a new method? apart from that all good

darrenwh’s picture

Status: Needs review » Needs work
T-lo’s picture

Status: Needs work » Needs review

Given all of the other migrate source plugins use the constructor in the same way, I'd suggest that's a more general code style request that you could make in a separate issue?

darrenwh’s picture

Status: Needs review » Reviewed & tested by the community

OK if your happy with that...

  • pifagor committed 6daf645 on 7.x-2.x
    Issue #2654222 by das-peter: PHP7 Uniform Variable Syntax. Issue #...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Done

pifagor’s picture

Status: Fixed » Closed (fixed)