Hey,
-- ok I got it. I had added a "virtual property" to my User-Entity before like so:
protected function _getGender() {
$genders = $this->getGenders();
if(isset($this->_properties['gender']) && isset($genders[$this->_properties['gender']])) {
$genderLabel = $genders[$this->_properties['gender']];
return $genderLabel;
} else {
return '';
}
}
I didn't know that this will overwrite any existing value for the property "gender" when reading/saving a user record and turns it into a string , and that's going to be saved as 0 because the table has an INT field instead of a string. I modified the virtual property to
protected function _getGenderLabel() {..}
and now I can use this in my views like so:
<?php echo $user->genderLabel; ?>
Currently this sounds a bit dumb, but maybe it helps someone else who runs into the same problem.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment