How can get model instance dynamic?

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!

Try:

$model = CActiveRecord(‘User’);

$users = $model->findAll()

thank you !

but seens not work




class A

{

    public static function b()

    {

        echo 'wee!';

    }

}


$a = 'A';

$a::b();



Works only in PHP 5.3 + …

Try




$model = CActiveRecord::model($this->model);

$model->findAll();



great,it’s work,thank you!!!