# Call \_\_get on Entity

**URL:** <https://discourse.cakephp.org/t/call-get-on-entity/5231>\
**Category:** Uncategorized\
**Created:** [November 8, 2018, 2:02pm UTC](https://discourse.cakephp.org/t/call-get-on-entity/5231 "2018-11-08T14:02:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaLaLand](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@LaLaLand](https://discourse.cakephp.org/u/LaLaLand)\
**Post date:** [November 8, 2018, 2:02pm UTC](https://discourse.cakephp.org/t/call-get-on-entity/5231/1 "2018-11-08T14:02:46Z")

</div>

I’m trying to change my Customers-Entity to comply with GDPR.  
When a custumer is set to “inactive” the properties should be displayed as ‘\*\*\*\*\*’.  
Now, when I#m using find() in my controller and prase it as a JSON, the properties are still visible.  
Only a virtual property is hidden correctly.  
How can I make sure, the \_\_get Method is called for each entity. Or any other solution for this problem?

Here is my code of the Entity  
public function &\_\_get($s) {  
if ($this-\>\_properties[‘inactive’]) {  
return ‘\*\*\*\*\*’;  
} else {  
if ($s == “full\_name”) {  
return $this-\>\_properties[‘name’] . ', ’ . $this-\>\_properties[‘firstname’];  
} else {  
return $this-\>\_properties[$s];  
}  
}  
}

An the code from the controller

```
$this->loadmodel('Customers');
        $customers = $this->Customers->find()->order('name, firstname')->where('id > 1000');
        /*
        foreach ($customers as $customer) {
            $customer['fullname'] = $customer->fullname;
        }
        $this->set('customers', $customers);
        $this->set('_serialize', 'customers');*/

        echo json_encode($customers);
        die;
```
