title: Fatal Error : Cannot use object of type as array
body: <p>So, I this error appeared when I try to get a list of array from object singleton.</p>
  
  <p>This one is the singleton on CardType.php</p>
  
  <pre><code>class CardTypeAPIAccessor extends GuzzleClient
  {
  
      private $client;
  
      public function __construct($client) 
      {
          if($client instanceof GuzzleClient)
          {
              $this-&gt;client = $client;
          }
          else
          {
              $this-&gt;client = parent::getClient();
          }
      }
  
      public function getCardTypes() {
          $cardTypes = array();
  
          try 
          {
  
              $response = $this-&gt;client-&gt;get('admin/card/type',
                  ['headers' =&gt; ['Authorization' =&gt; $_SESSION['login']['apiKey']]
              ]);
  
              $statusCode = $response-&gt;getStatusCode();
              // Check that the request is successful.
              if ($statusCode == 200) 
              {
                  $error = $response-&gt;json();
                  foreach ($error['types'] as $type) 
                  {
                      $cardType = new CardType();
                      $cardType-&gt;setCardTypeId($type['card_type_id']);
                      $cardType-&gt;setCategory($type['category']);
  
                      array_push($cardTypes, $cardType);
                  }
              }
          }
          catch(RequestException $e) 
          {
              //todo
              echo $e-&gt;getRequest() . "&lt;/br&gt;";
              if ($e-&gt;hasResponse()) 
              {
                  echo $e-&gt;getResponse() . "&lt;/br&gt;";
              }
          }
          return $cardTypes;      
      }
  }
  </code></pre>
  
  <p>And this is the code on card_type.php</p>
  
  <pre><code>&lt;?php
       $cardTypes = $cardTypeAPIAccessor-&gt;getCardTypes();
       foreach ($cardTypes as $cardType){
       $Type = new CardType();
  ?&gt;
       &lt;tr&gt;
          &lt;!-- The error is here--&gt;
          &lt;td class="numeric"&gt;&lt;?php echo $Type-&gt;getCardTypeId($cardType['card_type_id']); ?&gt;&lt;/td&gt;
          &lt;td class="numeric"&gt;&lt;?php echo $Type-&gt;getCategory($cardType['category']); ?&gt;&lt;/td&gt;
       &lt;/tr&gt;
  </code></pre>
  
     
  
  <p>The error said :Cannot use object of type CardType as array</p>
  
  <p>Is my code went wrong ? </p>
  
  <p>Thanks </p>