Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Request #3089 Structures_DataGrid_Column::formatter() does not support static method callback
Submitted: 2005-01-04 01:20 UTC
From: rolf at winmutt dot com Assigned: asnagy
Status: Bogus Package: Structures_DataGrid
PHP Version: 5.0.3 OS: Linux 2.6
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 26 - 19 = ?

 
 [2005-01-04 01:20 UTC] rolf at winmutt dot com
Description: ------------ When passing array('class','method') to formatter it does not allow you to pass any type of additional arguments. It would be nice to do so.

Comments

 [2005-01-04 03:59 UTC] winmutt at winmutt dot com
snowcrash DataGrid # diff Column.php ~winmutt/pear/Structures_DataGrid/DataGrid/Column.php 186,189c186 < } elseif (is_array($this->formatter) && is_array($this->formatter[0])) { < $formatter = $this->formatter[0]; < $paramList = array_merge($this->formatter[1], $record); < } else { --- > } else { 196c193 < $result = call_user_func($formatter, ($paramList?$paramList:$record)); --- > $result = call_user_func($formatter, $paramList);
 [2005-01-05 19:16 UTC] asnagy at webitecture dot org
I am curious as to why you would want to pass an array of class and method? The code supports both syntaxes: $class->method() and Class::method() For example: $dg->addColumn(new Structures_DataGrid_Column('Edit', null, null, array('align' => 'center'), null, Printer::printLink($label=Edit)'); Please explain your reasoning better
 [2005-01-07 00:40 UTC] winmutt at winmutt dot com
The problem is passing more complex paramaters to the callback function. If I want to pass an object or complex array, the current string parsing failes.
 [2005-01-08 19:10 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-01-10 15:24 UTC] asnagy at webitecture dot org
Yes, you can't pass parameters into a callback array. Try something like this: $callback = 'Printer::printLink($label=Edit, $foo=Bar, $name=John Doe)'; $dg->addColumn(new Structures_DataGrid_Column('Edit', null, null, array('align' => 'center'), null, $callback); This way you can call a method and pass numerous parameters. If this is not the answer to your question, please include an example of what you are trying to do. Otherwise this bug will be closed as bogus.
 [2005-01-18 17:46 UTC] asnagy at webitecture dot org
Thank you for taking the time to write to us, but this is not a bug. All features asked for already exists
 [2005-01-19 23:57 UTC] rolf at winmutt dot com
I'm trying to pass complex data back to a callback function in a object : mixed call_user_func ( callback function [, mixed parameter [, mixed ...]] ) IE : call_user_func(array(&$bsq,'shop'),&$someobj,$cloneobj, $somearray); My patch listed works just fine and does not break any existing functionality.
 [2005-09-06 03:37 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!