NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Debugging in CakePHP framework


Joined: 06 Jun 2007
Posts: 5
Reply with quote
I'm sure I'm missing something rather basic here, but this has me stumped. I've been using phped for about a year now but in a non-oo/mvc environment.

Now, what's got me stumped is how to setup the project properties. The view files are templates (thtml) and setting break points within the controllers won't work for me. I'd like to be able to setup and run within phped or run from an external browser and hit breakpoints, but neither will work for me.

As I started with, I suspect I'm missing a concept of debugging within an oo/mvc framework. If there's anyone out there that can point me toward a document, or example, I would greatly appreciate it. I'm quite interested in upgrading to the new version of phped, but if I can't debug in this new environment (demitri assistance enticement), it doesn't make sense to spend the money.

Thanks in advance.

tdo
View user's profileFind all posts by tdodevSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Most if not all templates for php are not written in php. In other words, they can't be executed as scripts and therefore you can not debug them.
You may wan to consider template as a macro-extension to a markup language (HTML/XHTML)

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 06 Jun 2007
Posts: 5
Reply with quote
Dmitri,

Thanks for your reply. I've given up on the prospect of debugging the view (template) files. I'd be ecstatic if I could simply set breakpoints within the controllers (logic) or models (db access). Both are defined as classes and I'm sure they're instantiated, but for some reason, I never hit any breakpoints.

I can only imagine that I'm missing some fundamental phped oo debugging paradigm.

I can't imagine, however, that I'm the only person that would like to use your product with cakephp?

Thanks again Dmitri for your help!
- tdo
View user's profileFind all posts by tdodevSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I'd recommend you to read FAQ forum running on this board and in particular please take a look at the post entitled "how to run debug session" (or something like this)

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Debugging Cake


Joined: 21 Jun 2007
Posts: 2
Reply with quote
I was able to debug and step through the codes on my controller using PHPed on cakephp by setting a breakpoint at the dispatcher.php file as listed below:

function _invoke (&$controller, $params, $missingAction = false) {
$this->start($controller);
$classVars = get_object_vars($controller);

if ($missingAction && in_array('scaffold', array_keys($classVars))) {
uses(DS.'controller'.DS.'scaffold');
return new Scaffold($controller, $params);
} else {
$output = call_user_func_array(array(&$controller, $params['action']), empty($params['pass'])? null: $params['pass']); //->>>>I placed a breakpoint in to this line and step in through it
}
if ($controller->autoRender) {
$output = $controller->render();
}
$controller->output =& $output;
$controller->afterFilter();
return $controller->output;
}



Now, I run into a little bit of problem on parameter passing. I tried passing a GET parameter variable and it works but somehow I don't know why the variable is not passed using POST. So I tried to trace the problem by simulating a POST variable at the main cakephp webroot. Here's my test case:

@cakephp index.php (main webroot)

32: $val = $_POST; // I just placed this line for me to evaluate the parameter that get's passed if any
33: if (!defined('DS')) {
34: define('DS', DIRECTORY_SEPARATOR);
35: }

$_POST value is null but If I pass a GET query the data get's passed. I can't find any reason why. Is this a Phped bug?

I used PHPEd's internal Parameters form to pass my variables.


View user's profileFind all posts by bonjomaticSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Please note that POST will work if you use INTERNAL (embedded) internet explorer and only.

On the other hand, you can use Debugger Toolbar available for FireFox and Internet Explorer and check trigger debugger on next POST, then click submit on the form.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
cakephp debugging problem with POST


Joined: 21 Jun 2007
Posts: 2
Reply with quote
Thanks for the Info.. Will check your tip.
View user's profileFind all posts by bonjomaticSend private message
Debugging in CakePHP framework
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic