Insert facebook profile picture into blob column mysql
<p>I'm trying to integrate facebook connect into our website (Symfony) for this we use FOSFacebookBundle.</p>

<p>I was able to do that and getting my facebook id, first_name, and last_name and insert them into a new user in our fos_user column.</p>

<p>Regarding the user profile picture I keep receive an exception :</p>

<pre><code>An exception occurred while executing 'INSERT INTO fos_user (username, username_canonical, email, email_canonical, enabled, salt, password, last_login, locked, expired, expires_at, confirmation_token, password_requested_at, roles, credentials_expired, credentials_expire_at, nom, prenom, solde, path, sexe, date_Naissance, facebookId, photo) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["1223800560964254", "1223800560964254", "******@gmail.com", "*********@gmail.com", 1, "", "", null, 0, 0, null, null, null, "a:1:{i:0;s:12:\"ROLE_PORTEUR\";}", 0, null, "Mohamed", "Elloumi", null, null, null, null, "1223800560964254", {"data":{"is_silhouette":false,"url":"https:\/\/fbcdn-profile-a.akamaihd.net\/hprofile-ak-ash2\/v\/t1.0-1\/c85.25.315.315\/s50x50\/580232_622196307791352_1230572455_n.jpg?oh=17c02ae42bb18d3ddbe3cfdf04239049&amp;oe=57AC3250&amp;__gda__=1474408706_227fd87692ead8189d332a4898571e62"}}]:

Notice: Array to string conversion
</code></pre>

<p>And I think that it's because I'm trying to add the full picture api Graph response into the blob column:</p>

<pre><code>{
  "picture": {
    "data": {
      "is_silhouette": false,
      "url": "https://fbcdn-profile-a.akamaihd.net/****"
    }
  },
  "id": "792374454106869"
}
</code></pre>

<p>I guess that I only need the insert this line into my blob column :</p>

<pre><code>"url": "https://fbcdn-profile-a.akamaihd.net/****"
</code></pre>

<p>I'm using this php function to insert into the fos_user table :</p>

<pre><code>public function setFBData($fbdata) // C'est dans cette méthode que vous ajouterez vos informations
    {
        if (isset($fbdata['id'])) {
            $this-&gt;setFacebookId($fbdata['id']);

            $this-&gt;addRole('ROLE_PORTEUR');
        }
        if (isset($fbdata['first_name'])) {
            $this-&gt;setNom($fbdata['first_name']);
        }
        if (isset($fbdata['last_name'])) {
            $this-&gt;setPrenom($fbdata['last_name']);
        }
        if (isset($fbdata['email'])) {
            $this-&gt;setEmail($fbdata['email']);
        }
        if (isset($fbdata['picture'])) {
            $this-&gt;setPhoto($fbdata['picture']);
        }
    }
</code></pre>