custom field on the edit page in the admin generator not calling
getter
I need some help with adding a custom field to the admin generator:
I have a model that contains a field 'end_ts'. I want to make a
custom getter/setter/field end_time that doesn't exist in the model.
Everything works but the edit page. End Time shows up just fine in
the list(index), but it's not populated in the edit page (it's always
at 00:00). Not only that, but if I put a die() in the getter, the
edit page loads fine. But the list page exits as it's expected to.
Thanks!
Game.class.php
public function getEndTime($format = 'H:i') {
return date($format, strtotime($this->getEndTs()));
}
public function setEndTime($time) {
$this->setEndTs($this->getDate().' '.$time);
}
GameForm.class.php
public function configure() {
$this->widgetSchema['end_time'] = new sfWidgetFormTime();
$this->validatorSchema['end_time'] =
new sfValidatorTime(array('required' => false));
}
generator.yml
generator:
class: sfDoctrineGenerator
param:
model_class: Game
theme: jroller
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: game
with_doctrine_route: 1
config:
actions: ~
fields:
league_id: { label: League }
field_id: { label: Field }
home_team_id: { label: Home Team }
away_team_id: { label: Away Team }
game_status_id: { label: Status }
start_ts:
label: Start
help: The day and time the this game starts
end_ts:
label: End
help: The date and time that this game ends
end_time:
label: End
help: The time that this game ends
list: ~
filter: ~
form: ~
edit:
fields [field_id, league_id, home_team_id, away_team_id,
game_status_id, start_ts, end_ts, home_team_score, away_team_score]
new: ~
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---