How to use model outside of Yii-app ?

Hi all.

I have Yii-based web app which is used as admin area to manage timetable of tasks auto-run.

Each task has last start time and last end time. These attributes should be updated outside of

the web app - in the cron script which is actually running tasks.

Is it possible (and correct) to amend classes generated during Yii-scaffolding process (model and CRUD generation)

and use them outside of web app generated by Yii ?

My idea to solve such situation is the following:

  1. Add a couple of methods into the model class (within web app) with names like ‘updateStartTime’ and ‘updateEndTime’

  2. Include (somehow) web app initialization into cron script, get access to model class and use the methods above.

Is it the correct approach ? Maybe I am planning something wrong and it is not good design solution ?

I am not very experienced app designer, any help will be great. Thanks in advance.

The answer is simple: Write a Yii console command as described here:

You have full access to all your models.

Got it, thx for the help. =)