Model initialization

Hello,

I have multiple models with same name.

app\models\year2016\Asset

app\models\year2015\Asset

app\models\year2014\Asset

.

.

.

Depending on a certain condition, I want to initialize the model. I am trying like this:

$current_year = date(‘Y’);

$asset = new app\models\year.$current_year.\Asset();

This is not working. Can anybody help please.

Thanks.

Does this help?

http://stackoverflow.com/questions/4513366/php-namespace-with-dynamic-class-name

Thanks Patrick!! It worked…