PacktPublishing / Developing-Extensions-for-Joomla-5

Developing Extensions for Joomla! 5, published by Packt
MIT License
7 stars 4 forks source link

Chapter 1: Problems with Faker Data Import #7

Open SumCompanyInc opened 5 months ago

SumCompanyInc commented 5 months ago

Again, first off, appreciate the effort to write the book and create the tutorial for us. and appreciate the exposure to FakerPHP.

I think there is a bug in the create-mock-customers.php code.

$csv[0] = $headers;
for ($line = 0; $line < $totalLines – 1; $line++) {
  ...
  $csv[$line] = $data;
}

$headers gets overwritten when $line = 0, and $csv[$line] is set with $data

The company_address appears to be going to the next line from the generation..

lines 1 -7

firstname,lastname,email,company_name,company_id,company_address,phone
Alvina,Hermann,lcassin@mayer.com,"Powlowski Ltd",32-9749773,"730 Lebsack Walks Apt. 815
New Flavieland, AK 24293",1-858-688-9676
Joanie,Kihn,mann.maci@hotmail.com,"Auer, Simonis and Erdman",46-7119760,"547 Tracy Burgs
Lake Omaberg, IL 90101","+1 (513) 770-7332"
Emanuel,Mante,leonel.walker@gutmann.com,"Walker LLC",53-9740405,"41371 Lavon Harbors
South Aracelyborough, MA 38224","(704) 381-2068"

anyways.. the book says to import csv into the db via phpmyadmin .. but the process appears trivial in the instructions, but apparently, not trivial for me. :/