NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
How can PhpED debugger be used to debug script which uses Do


Joined: 27 Nov 2009
Posts: 67
Reply with quote
Edit. I just noticed that subject line get's truncated. The title should have been: How can PhpED debugger be used to debug script which uses Doctrine

PhpED is configured where the root directory is /var/www/testapp, and within this directory, I have the typical public and src directory as well directory /var/www/testapp/var/doctrine/proxy which contains proxy files created by Doctrine. Within my application, I have the following method.

Code:
<?php
namespace Michael\Testapp\Api\Point;
class PointService
{
    public function index(array $params=[]):array {
        syslog(LOG_INFO, 'Before $account=$this->account');
        $account=$this->account;
        syslog(LOG_INFO, 'Before $points=$account->getPoints()');
        $points=$account->getPoints();
        syslog(LOG_INFO, 'Before $points->getValues()');
        $pointValues=$points->getValues();
        syslog(LOG_INFO, 'After $points->getValues()');
        return $pointValues;
    }
}


When I run index.php which eventually calls this method from either Apache or using PhpED's Run, I get the below results.

Code:
Mar 13 16:39:53 Devserver PublicAPI[59900]: Before $account=$this->account
Mar 13 16:39:53 Devserver PublicAPI[59900]: Before $points=$account->getPoints()
Mar 13 16:39:53 Devserver PublicAPI[59900]: Before $points->getValues()
Mar 13 16:39:53 Devserver PublicAPI[59900]: After $points->getValues()


But if I run the same index.php using PhpED's debugger, I witness:

Code:
Mar 13 16:46:50 Devserver PublicAPI[59900]: Before $account=$this->account
Mar 13 16:46:54 Devserver PublicAPI[59900]: Before $points=$account->getPoints()


PhpED's local window shows $this->account as being: object(Proxy\__CG__\Michael\Testapp\Domain\Entity\Account\Account) and a partial copy is below. From this point on, all code is Doctrine and not mine. I am able to trace the code all the way to when it calls \Doctrine\ORM\Proxy\ProxyFactory::createInitializer() and it ends without errors.

Code:
<?php

namespace Proxy\__CG__\Michael\Testapp\Domain\Entity\Account;

/**
 * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE'S PROXY GENERATOR
 */
class Account extends \Michael\Testapp\Domain\Entity\Account\Account implements \Doctrine\ORM\Proxy\Proxy
{
    public function getPoints()
    {

        $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPoints', []);

        return parent::getPoints();
    }
}


How can PhpED debugger be used to debug script which uses Doctrine?


Last edited by NotionCommotion on Wed Mar 20, 2019 5:48 am; edited 1 time in total
View user's profileFind all posts by NotionCommotionSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7943
Reply with quote
I'm not sure how "PhpEd Debugger" can be compared with Apache. PhpED IDE can work with a) local or remote PHP CLI directly or b) SRV, bundled web server or c) local or remote Apache or any other web server capable of running php. So if you mean you didn't succeed running your project with SRV, you can try Apache. In order to do this you may want to create project and proceed with project settings Wizard.

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


Joined: 27 Nov 2009
Posts: 67
Reply with quote
Hi dmitri,

I just noticed that my subject title was truncated on my original post which might have caused some confusion. I have no problems using PhpED most of the time and think it is great, and typically use the remote web server configuration. The only small issue I have with this option is that it doesn't immediately allow me to debug API's which consume PUT and DELETE requests. I expect the CLI configuration will meet this need, however, another great option is to create a small web page which has a php extension (even if it contains no PHP) and a little Javascript to make a request, and the API PHP script can be followed using the debugger just like any other script.

It is only when the API script uses Doctrine that I am experiencing issues. When using the PhpED debugger, the initial entry point file is executed, my routing scripts are executed, Doctrine is queries, but then when when returning the results, the script just mysterious ends without error. I think it has something to do with Doctrine's use of proxies and/or cache, but am not sure.

Any recommendations how to use the PhpED debugger for scripts which utilize Doctrine?

Thanks
View user's profileFind all posts by NotionCommotionSend private message
How can PhpED debugger be used to debug script which uses Do
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