title: How to use TableRegistry in CakePHP component?
body: <p>I am new in cakephp, and trying to create a component using <strong>cakephp version 4.0.7</strong> .</p>
  <p>In component I need to save data in a table. I have followed this <a href="https://book.cakephp.org/4/en/orm/saving-data.html#inserting-data" rel="nofollow noreferrer">documentation on inserting data</a></p>
  <p>In component I have tried below code for registry My table</p>
  <pre><code>use Cake\ORM\Locator\LocatorAwareTrait;
  
  class MyComponent extends Component{
  
      public function foo()
      {
           $ProductsTable = $this-&gt;getTableLocator()-&gt;get('Products');
      }
  
  }
  </code></pre>
  <p>In output I am getting below exception</p>
  <pre><code>Call to undefined method App\Controller\Component\MyComponent::getTableLocator()
  </code></pre>
  <p>How can I solve this problem ?</p>