title: Filter off some elements away from php object
body: <p>Not sure if this is a php or cakephp question. I am using cakephp ver3.1.3. I have a cakephp query object <code>$query</code> that look like this when I call <code>debug($query-&gt;toArray());</code></p>
  
  <pre><code>[
      (int) 0 =&gt; object(App\Model\Entity\Customer) {
  
          'id' =&gt; (int) 1,
          'username' =&gt; 'asd',
          'password' =&gt; '123',
          'fullname' =&gt; 'asd',
          'email_addr' =&gt; 'asd@gmail.com',
          '[new]' =&gt; false,
          '[accessible]' =&gt; [
              '*' =&gt; true
          ],
          '[dirty]' =&gt; [],
          '[original]' =&gt; [],
          '[virtual]' =&gt; [],
          '[errors]' =&gt; [],
          '[repository]' =&gt; 'Customers'
  
      }
  ]
  </code></pre>
  
  <p>When I call <code>json_encode($query)</code>, it looks like this;</p>
  
  <pre><code>[
      {
          "id": 1,
          "username": "asd",
          "password": "123",
          "fullname": "asd",
          "email_addr": "asd@gmail.com"
      }
  ]
  </code></pre>
  
  <p>How do I process $query such that when I call <code>json_encode($query)</code>, the output will look like this?</p>
  
  <pre><code>[
      {
          "email_addr": "asd@gmail.com"
      }
  ]
  </code></pre>