as a newbie to cakephp for me it looks like that 'normal' models don't
have any more common member variables, but associative arrays.
For example I have a model 'Person' with firstname, lastname, age etc.
Generally i would solve this with member variables $firstname,
$lastname and $age and their common getters and setters
setFirstname($value), getAge(), etc., but this still does have sense?
When i save a person i have to use an associative array, so with my
technique i need to create first an array ($data = array()) out of my
common member variables to pass it to model's function ->save($data)
Does it mean that the common member variables are obsolete and i
actually only have to use one member variable $data and use it then
like:
function setFirstname($value){ $this->data['firstname'] = $value;}; or
function getAge(){ return $this->data['age']; }; ?
The same when i want to make a new instance of a Person and retrieve
their variables from the database:
Does it has to look like following then?
$person = new Person();
$person->retrieve(5); // ID
and the model Person has a function retrieve($id) when i get then its
data from the database and set it to $this->data??
I hope i made me explain at least a little and you understand my
question :)
Thanks for any advice or example!
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment