Yii Framework Forum: Custom Classes - Yii Framework Forum

Jump to content

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

Custom Classes Rate Topic: -----

#1 User is offline   waterloomatt 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 545
  • Joined: 09-April 10

Posted 10 April 2010 - 08:10 PM

Hi,

I have a situation where I'd like to display a summary of Bids for a particular Post. There are several fields including lastBidDate, bidCount, averageBidsPerDay etc... My idea is to create a class, called BidSummary, pass it a Post object and have the class calculate the fields. I would then simply call the public properties in my views.

Is this a viable solution? In what folder do I create my custom classes. Would it be a Model?

Cheers.
0

#2 User is offline   Vince. 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 432
  • Joined: 29-December 08
  • Location:Los Angeles,CA

Posted 12 April 2010 - 06:57 AM

I am not sure this can be a Model, Unless you put the logic you are willing to do inside the Post model your fetching the data from. Depends on the type of manipulation your about to do on the data, You can create a class to handle that inside the protected/components or protected/modules/moduleID/components (Or create it as an extension and place it under protected/extensions) and extend from either CApplicationComponent or CExtController.
Vince Gabriel, Lead Developer.
Posted ImagePosted ImagePosted Image
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