i have a component.in this component,i want get model instance from model,like this:
component
<?php
class TestComponent extends CComponent
{
public $model;
public function __construct($model)
{
$this->model = $model;
}
public function test()
{
$user = $this->model::model()->findAll();
}
}
model
public function test()
{
$tree = new TestComponent('User');
$tree->test();
}
there has a error,i don’t know how to make model work in the TestComponent,please give me a idea,thanks!