You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know wether i'm doing something wrong here or forgetting something but heres the weird thing.
When parsing an .xml file, if a field is empty it gets translated to an empty array, my guess is this is due to a multi-array functionality.
For instance this is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<request>
<company></company>
<first_name>Joe</first_name>
<insertion></insertion>
<last_name>Dirt</last_name>
<gender>0</gender> <!-- 0=male/ 1=female-->
<street>Somestreet</street>
<street_number>13</street_number>
<number_adjective></number_adjective>
<zipcode>0000AA</zipcode>
<city>Denver</city>
<email1>j.dirt@somedomain.com</email1>
<email2></email2>
<contact_preference>3</contact_preference> <!-- 1=morning / 2=midday / 3=evening -->
<home_phone>0123456789</home_phone>
<mobile>0612345678</mobile>
<remarks>Some text here</remarks>
<date>2015-07-03</date> <!-- MySQL date format -->
<source_id>1</source_id> <!-- Internal unique number from supplier -->
<source_api>1234567890</source_api> <!-- API key -->
</request>
I am loading it with: $xml = Parser::xml(File::get($filename));
when doing a dd($xml); it gives me something like:
company = []
first_name = Joe
insertion = []
last_name = Dirt
gender = 0
street = Somestreet
street_number = 13
etc.
When inserting it in the database i get values named Array.
Is there any easy way for me to force empty fields to empty instead of array types?
The text was updated successfully, but these errors were encountered:
Hi,
I don't know wether i'm doing something wrong here or forgetting something but heres the weird thing.
When parsing an .xml file, if a field is empty it gets translated to an empty array, my guess is this is due to a multi-array functionality.
For instance this is my XML:
I am loading it with: $xml = Parser::xml(File::get($filename));
when doing a dd($xml); it gives me something like:
company = []
first_name = Joe
insertion = []
last_name = Dirt
gender = 0
street = Somestreet
street_number = 13
etc.
When inserting it in the database i get values named Array.
Is there any easy way for me to force empty fields to empty instead of array types?
The text was updated successfully, but these errors were encountered: