连接表行数据

I have 3 columns that I export as csv/xcls using PHP.

  • root
  • production conjugation
  • sku = root . "-" . production conjugation

enter image description here

Here is the code that export those 3 columns

case 'root':
      return !empty($image->product->sku) ? $image->product->sku : '';

 case 'productconjugation':
      return !empty($image->{$field}) ? $image->{$field}->short_name : "";

case 'sku':

      if(!empty($image->{$field})){
          return $image->product->sku.'-'.$image->{$field}->short_name;
      }else{
        return $image->product->sku;
      }

Result

It exported to production conjugation column, but for some reasons , when I tried to concatenate it in my sku colum. It never did.

I've been staring at my code all morning, and I couldn't really spot what I did wrong.


Question

Is this something that I did wrong in my switch case statement ?

How would one go about and debug this ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !