#1644: Add support for custom getter in Doctrine_Record::toArray()
--------------------------+-------------------------------------------------
Reporter: adrive | Owner: jwage
Type: enhancement | Status: new
Priority: minor | Milestone: 1.0.4
Component: Record | Version: 1.0.3
Resolution: | Keywords: toArray, record
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 1 |
--------------------------+-------------------------------------------------
Changes (by jwage):
* version: 1.1-DEV => 1.0.3
* milestone: => 1.0.4
Old description:
> It would be very useful to find a solution for custom getters in
> toArray(), as the form framework use this method to fill a values of form
> fields.
> Fox example: I have an array field, which I would like to translate to
> YAML format when displaying in form.
> Now I need to create a custom widget for it.
>
> Instead of this it would be nice to find a way how to call custom methods
> when toArray() is called.
> maybe in setTableDefinition or setUp should be setting to method that
> will set the map field => method.
>
> For example:
> {{{
> $this->setToArrayMap(array(
> 'variables' => getVariablesAsYaml,
> 'non_existing_column' => getFullName,
> '));
> }}}
> So toArray method should look into this map and when column has getter
> setted here, the getter will be called instead of the raw column value.
> Also extraneous fields that will be in this map and will have get methods
> will be called.
New description:
It would be very useful to find a solution for custom getters in
toArray(), as the form framework use this method to fill a values of form
fields.
Fox example: I have an array field, which I would like to translate to
YAML format when displaying in form.
Now I need to create a custom widget for it.
Instead of this it would be nice to find a way how to call custom methods
when toArray() is called.
maybe in setTableDefinition or setUp should be setting to method that will
set the map field => method.
For example:
{{{
$this->setToArrayMap(array(
'variables' => getVariablesAsYaml,
'non_existing_column' => getFullName,
'));
}}}
So toArray method should look into this map and when column has getter
setted here, the getter will be called instead of the raw column value.
Also extraneous fields that will be in this map and will have get methods
will be called.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1644#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" 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.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---