Skip to Content.
Sympa Menu

comanage-dev - Re: [comanage-dev] Re: [JIRA] (CO-254) Indirect modification errors

Subject: COmanage Developers List

List archive

Re: [comanage-dev] Re: [JIRA] (CO-254) Indirect modification errors


Chronological Thread 
  • From: Marie Huynh <>
  • To: Benn Oshrin <>
  • Cc:
  • Subject: Re: [comanage-dev] Re: [JIRA] (CO-254) Indirect modification errors
  • Date: Tue, 21 Feb 2012 12:31:13 -0800

So to back up a bit, the problem I'm looking at is this error:

2012-02-16 18:08:57 Error: [PDOException] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'field list' 
#0 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Datasource/DboSource.php(436): PDOStatement->execute(Array) 
#1 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Datasource/DboSource.php(403): DboSource->_execute('UPDATE `cm_co_n...', Array) 
#2 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Datasource/Database/Mysql.php(376): DboSource->execute('UPDATE `cm_co_n...') 
#3 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Model.php(1631): Mysql->update(Object(CoNsfDemographic), Array, Array)
#4 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Model.php(2071): Model->save(Array, Array) 
#5 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Model/Model.php(1908): Model->saveAssociated(Array, Array) 
#6 /Applications/MAMP/htdocs/gears/trunk/app/Controller/StandardController.php(355): Model->saveAll(Array) 
#7 [internal function]: StandardController->edit('1') 
#8 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Controller/Controller.php(473): ReflectionMethod->invokeArgs(Object(CoNsfDemographicsController), Array) 
#9 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Routing/Dispatcher.php(104): Controller->invokeAction(Object(CakeRequest)) 
#10 /Applications/MAMP/htdocs/gears/trunk/lib/Cake/Routing/Dispatcher.php(86): Dispatcher->_invoke(Object(CoNsfDemographicsController), Object(CakeRequest), Object(CakeResponse)) 
#11 /Applications/MAMP/htdocs/gears/trunk/app/webroot/index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse)) 
#12 {main} 

It's caused by the fact that demographics used the StandardController's edit(), which calls its checkWriteDependencies, which is where the arrays that carry race and disability are imploded to be saved as a string.  That worked perfectly fine in 1.3 but not in 2.0.  Given the changes, what is now the best way to make this also magically modify this data?  

On Tue, Feb 21, 2012 at 4:48 AM, Benn Oshrin <> wrote:
Err, of course there's a

 return;

in there. In that case we have to set $this->request->data so the form renders with the right stuff.


On 2/21/12 7:46 AM, Benn Oshrin wrote:
Both add() and edit() move things around into $data, which then gets
passed to routines like checkWriteDependencies and saveAll.

The line you cite is a bit out of place, as a bit later we get

$data = "$this->request->data;
I should clean that up.

Technically, you can write to $this->request, but I've been avoiding it
to improve the design of the code (fewer functions that magically work
by modifying things that weren't passed to it).

On 2/21/12 1:04 AM, Marie Huynh wrote:
In what situations then would it be advisable to do so? Which
intermediate data structures do you mean? I'm looking at things in
edit() in StandardController like
$this->request->data = "$curdata;


On Mon, Feb 20, 2012 at 6:32 PM, Benn Oshrin <
<mailto:>> wrote:

In general, I don't think it's advisable to directly write to
$this->data or $this->request with Cake 2. A bunch of the code I
rewrote in StandardController avoids this by working with
intermediate data structures instead.

On 2/20/12 8:44 PM, Marie Huynh (JIRA) wrote:


[
https://bugs.internet2.edu/__jira/browse/CO-254?page=com.__atlassian.jira.plugin.system.__issuetabpanels:comment-__tabpanel&focusedCommentId=__16454#comment-16454

<https://bugs.internet2.edu/jira/browse/CO-254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16454#comment-16454>

]

Marie Huynh commented on CO-254:
------------------------------__--

It is perhaps worth noting that modifying $this->request['data']
also logs a similar notice.

Indirect modification errors
----------------------------

Key: CO-254
URL:
https://bugs.internet2.edu/__jira/browse/CO-254
<https://bugs.internet2.edu/jira/browse/CO-254>
Project: COmanage
Issue Type: Sub-task
Components: Registry
Affects Versions: COmanage Registry 0.4 (Reshaped Cake)
Reporter: Marie Huynh
Assignee: Marie Huynh
Labels: sprint04
Fix For: COmanage Registry 0.4 (Reshaped Cake)


2012-02-20 02:16:50 Notice: Notice (8): Indirect
modification of overloaded element of CakeRequest has no
effect in
[/Applications/MAMP/htdocs/__gears/trunk/app/Controller/__CoNsfDemographicsController.__php,

line 141]
Trace:
CoNsfDemographicsController::__checkWriteDependencies() -
APP/Controller/__CoNsfDemographicsController.__php, line 141
StandardController::edit() -
APP/Controller/__StandardController.php, line 350
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() -
CORE/Cake/Controller/__Controller.php, line 473
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.__php,
line 104
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.__php,
line 86
[main] - APP/webroot/index.php, line 96


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA
administrators:
https://bugs.internet2.edu/__jira/secure/__ContactAdministrators!default.__jspa

<https://bugs.internet2.edu/jira/secure/ContactAdministrators!default.jspa>

For more information on JIRA, see:
http://www.atlassian.com/__software/jira
<http://www.atlassian.com/software/jira>










Archive powered by MHonArc 2.6.16.

Top of Page