如何在 cakephp4.2 的模型中访问另一个模型?关于这个问题的文档对我来说不清楚,然后我可以对此运行查询吗?TableRegistry 现已弃用。
error Unknown method "getTableLocator" called on App\Model\Table\LessonsTable
//none of these no longer work
in model {
use Cake\ORM\Locator\LocatorAwareTrait;
class LessonsTable extends Table
{
..
private function getlessonRevenue(){
//$clients = $this->getTableLocator()->get('Clients');
// $cleints = TableRegistry::get('Clients');
// $this->Table = TableRegistry::get('Clients');
$clients = $this->getTableLocator()->get('Clients');
Run Code Online (Sandbox Code Playgroud)
https://api.cakephp.org/4.0/class-Cake.ORM.TableRegistry.html