Jeremy Burns
jeremyburns@me.com
On 4 Jun 2010, at 16:24, calvin wrote:
> ^I'm pretty sure that debug() doesn't have a return value. So I
> usually just call debug($page);die;.
>
>
> DragonFlyEye:
> How many queries are in the query table? Are you sure you're looking
> at the right one? Is there some kind of command-line client for MS-SQL
> that you can use to see exactly what each query returns? And you have
> pretty non-standard field names (and probably table names as well).
> Did you use Cake Bake to generate all of your models or make sure that
> the models are all defined properly?
>
> On Jun 4, 6:46 am, Jeremy Burns <jeremybu...@me.com> wrote:
>> Hmmm. So you say that Cake is creating a SQL query that works, but the array that collects the results has empty elements where you would expect data? Here's a couple of suggestions.
>>
>> Remove recursive completely - not ideal for production, but a good check to see if it is somehow limiting it.
>>
>> Then, immediately after you run the query ($page = $this->find) try this:
>>
>> die(debug($page));
>>
>> What does that show?
>>
>> Jeremy Burns
>> jeremybu...@me.com
>>
>> On 4 Jun 2010, at 14:39, DragonFlyEye wrote:
>>
>>> I've searched the group a bit and haven't found anything that seems to
>>> exactly solve my problem. Let me begin with the basics:
>>
>>> This is a website which I am transitioning from an old ASP site into
>>> CakePHP. The site is driven by an MS-SQL database and being served
>>> from a Macintosh XServer running Apache2. So I am building Models
>>> based on the current database table structure and working from there.
>>> All of the connections seem to be working fine - queries are working
>>> perfectly - with the exception of my current problem.
>>
>>> The problem is that in some cases, queries seem to work fine but the
>>> resulting array ends up being empty. There's nothing fancy about the
>>> query function itself:
>>
>>> public function getPage($id) {
>>> $page = $this->find('first', array('conditions' => array('pageid' =>
>>> $id, 'Page.default_levelid = Page.levelid'),
>>> 'recursive' => 3
>>> ));
>>> return $page;
>>> }
>>
>>> And the resulting ['Page'] array is fine. The problem is the next
>>> associated Model, the PageChart model. Here is where I associate it to
>>> Page:
>>
>>> var $hasMany = array('PageChart' => array('foreignKey' => 'pageid',
>>> 'order' => 'line ASC'));
>>
>>> In the CakePHP query table from the debug mode shows a proper query
>>> returning 6 PageChart results. However, in the returned array, the
>>> ['PageChart'] sub-array is completely empty. There are currently no
>>> associated Models for the PageChart model - I've removed them in order
>>> to limit the scope of the problem.
>>
>>> I stress again that this is only a problem with certain queries for
>>> certain pages, not others. I am sure that, under the circumstances,
>>> there must be something about the data that is causing an issue.
>>> Otherwise, I would expect that the result would be either consistently
>>> right or consistently wrong, but not a bit of Column A and a bit of
>>> Column B.
>>
>>> What I'm hoping someone can shed some light on is why CakePHP might
>>> bork on data but not give an error message. Character encoding
>>> problems? Spaces? Something like that?
>>
>>> I really appreciate the help.
>>
>>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions.
>>
>>> You received this message because you are subscribed to the Google Groups "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscribe@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment