You need to sign in to do that
Don't have an account?
M in MVC
Hey everyone. This must be a redundant question, but it's a hard thread to search for. I'm coming from rails and the 'active record' pattern so forgive me if this is ignorant.
How on earth do i extend an SObject with my own functionality? Or where does my logic 'live'?
Should i make a wrapper object with an Apex Class?
I'm aware of formula's, but it's slightly limited for what i'm going for.
Thanks for your help in advance!
- Brian
Example:
So i have a visual force view. I also have this extension. So how can i implement roadRage()
public class MileageExtension {
private final Mileage__c mileageObj;
public MileageExtension(ApexPages.StandardController controller) {
this.mileageObj = (Mileage__c)controller.getSubject();
}
// where do i put all the methods?
public void roadRage() {
Car car = mileageObj.getCar();
Person driver = mileageObj.getDriver();
car.honk();
driver.giveFinger();
car.swerve();
driver.slowDownInEmbarrassment();
}
}
08-22-2009 08:39 PM
My simplest understanding about MVC
M -- sObject, wrapper object will needed if the page need a more complex object other than sObject;
V -- vf page
C -- controller, your logic is actully apex functions.
All Answers
My simplest understanding about MVC
M -- sObject, wrapper object will needed if the page need a more complex object other than sObject;
V -- vf page
C -- controller, your logic is actully apex functions.
Thanks for the reply!
Now I won't always second guess myself when wrapping.