I am trying to access service locator object inside my controller but unable to do this.  

I tried online help but most of them are following approach for `ZF2`  

Previously Servicelocator access in `zf2` was a breeze, I just had to do $this->getServiceLocator();  

I have tried creating factory Class for my controller and Created createService method there but it says I have to implement `__invoke()` method too.  

My Objective is to do something like this

```
public function getPropertyTable()
{
    if (!$this->PropertyTable) {
        $sm = $this->getServiceLocator();
        $this->PropertyTable = $sm->get('Application\Model\PropertyTable');
    }
    return $this->PropertyTable;
}

```

Can anyone provide me a complete steps to achieve this?  

I have tried to implement almost all Answers related to Servicelocator before asking this question, so please help me before marking this as Duplicate or something, ignore the typos