Yii Framework Forum: How to use model outside of Yii-app ? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to use model outside of Yii-app ? Rate Topic: -----

#1 User is offline   Alexander K 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-October 11
  • Location:Moscow

  Posted 30 May 2012 - 04:18 AM

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.
0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 30 May 2012 - 04:28 AM

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

http://www.yiiframew...eating-commands

You have full access to all your models.
0

#3 User is offline   Alexander K 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 06-October 11
  • Location:Moscow

Posted 30 May 2012 - 05:22 AM

View PostMike, on 30 May 2012 - 04:28 AM, said:

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

http://www.yiiframew...eating-commands

You have full access to all your models.


Got it, thx for the help. =)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users