#6523: Result set of find() method different depending on conditions sepcifed on MySQL views ---------------------------+------------------------------------------------ Reporter: rb5894 | Owner: Type: Bug | Status: new Priority: High | Milestone: 1.2.x.x Component: Model | Version: 1.2 Final Severity: Major | Resolution: Keywords: | Php_version: PHP 4 >= 4.3.2 Cake_version: 1.2.3.8166 | ---------------------------+------------------------------------------------ Old description:
> Hi > > When using find() method on views the array returns splits into three > different indexes right after I add one condition to the query > 'viewname.column' => $passedValue, if I remove this conidtion I get one > index to reach columns. That's how the returned record looks like with > the condtion > $rec['index1']['col1'], > $rec['index1']['col2'] > ... > $rec['index2']['col10'], > $rec['index2']['col11'] > ... > $rec['index3']['col20']. > While without the contion I get > $rec['index1']['col1'], > $rec['index1']['col2'] > ... > $rec['index1']['col10'], > $rec['index1']['col11'] > ... > $rec['index1']['col20']. > > This bug coused me to move my application from one server to another. I > was using PHP5 before and couldn't narrow it down so I though it was PHP > or server configuration. Before moving the application the behaving was > different as it wasn't based on the condition - just indexes were > differnet. On my local machine the results coming back were > $rec['viewName']['colName'] on the hosted server it was > $rec['0']['colName']. I tough it was the hosting server that was the > issues until I added this condition now, it became clear to me that it > was the cake causing this weird behavior. > > I noticed that the names of the indexes are first part of the > two/three/four word made of underscores. If I have two tables 1) cars > with a column name and 2) roads with a column name and create a things > view out of them with c_name and r_name for car and road names. The > record returned, after adding the condition, would be $rec['r']['rame'] > and $rec['c']['c_name'] instead of $rec['Thing']['c_name'] and > $rec['Thing']['r_name']. > > I'm sorry for confusing people with as I conbined two bugs into one, sort > of. To summarize two months ago I moved my application because indexes > were different on my local machine then hosting server. At that time it > wasn't split into 3 different ones like I get one just one was different > name instead of 'viewName' I had '0'. Now the behavior was different as > there is three different indexes for one view but I believe these two are > connected somehow as it always happenes on the views and not tables. New description: Hi When using find() method on views the array returns splits into three different indexes right after I add one condition to the query {{{'viewname.column' => $passedValue}}}, if I remove this conidtion I get one index to reach columns. That's how the returned record looks like with the condtion {{{ $rec['index1']['col1'], $rec['index1']['col2'] ... $rec['index2']['col10'], $rec['index2']['col11'] ... $rec['index3']['col20']. }}} While without the contion I get {{{ $rec['index1']['col1'], $rec['index1']['col2'] ... $rec['index1']['col10'], $rec['index1']['col11'] ... $rec['index1']['col20']. }}} This bug coused me to move my application from one server to another. I was using PHP5 before and couldn't narrow it down so I though it was PHP or server configuration. Before moving the application the behaving was different as it wasn't based on the condition - just indexes were differnet. On my local machine the results coming back were {{{$rec['viewName']['colName']}}} on the hosted server it was {{{$rec['0']['colName'].}}} I tough it was the hosting server that was the issues until I added this condition now, it became clear to me that it was the cake causing this weird behavior. [[BR]][[BR]] I noticed that the names of the indexes are first part of the two/three/four word made of underscores. If I have two tables 1) cars with a column name and 2) roads with a column name and create a things view out of them with c_name and r_name for car and road names. The record returned, after adding the condition, would be {{{$rec['r']['rame']}}} and {{{$rec['c']['c_name']}}} instead of {{{$rec['Thing']['c_name']}}} and {{{$rec['Thing']['r_name']}}}. [[BR]][[BR]] I'm sorry for confusing people with as I conbined two bugs into one, sort of. To summarize two months ago I moved my application because indexes were different on my local machine then hosting server. At that time it wasn't split into 3 different ones like I get one just one was different name instead of 'viewName' I had '0'. Now the behavior was different as there is three different indexes for one view but I believe these two are connected somehow as it always happenes on the views and not tables. Comment (by mark_story): Reformatting for readability -- Ticket URL: <https://trac.cakephp.org/ticket/6523#comment:1> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---