Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update db plugin to require generic abstract db adapter #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Caffe1neAdd1ct
Copy link

Phalcon 4 compatibility

Fixes the following error:

TypeError: Argument 2 passed to Fabfuel\Prophiler\Plugin\Phalcon\Db\AdapterPlugin::beforeQuery() must be an instance of Phalcon\Db\Adapter, instance of Phalcon\Db\Adapter\Pdo\Mysql given

Once fixed the toolbar seems to be functioning fine when initialised as follows:

$profiler = new \Fabfuel\Prophiler\Profiler();
$di->setShared('profiler', $profiler);

$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Database\QueryAggregator());
$profiler->addAggregator(new \Fabfuel\Prophiler\Aggregator\Cache\CacheAggregator());

$pluginManager = new \Fabfuel\Prophiler\Plugin\Manager\Phalcon($profiler);
$pluginManager->register();

image

Queries are being logged, request info is available and timeline/memory/etc are being displayed. Not a full compatibility test but seems to be mostly working.

@fabfuel
Copy link
Owner

fabfuel commented Sep 6, 2020

Thanks @Caffe1neAdd1ct!

I have not worked with Phalcon a while. Would you have time to check the build error in Travis CI?

Best
Fabian

@Caffe1neAdd1ct
Copy link
Author

Hi @fabfuel

I'll have a look when time permits, however this will need a Phalcon 4 build which would in turn need a few other build requirements:

Here are my notes from the latest install on arch linux:

Download zephir.phar
wget https://github.com/phalcon/zephir/releases/download/0.12.19/zephir.phar

Compile PSR
git clone https://github.com/jbboehr/php-psr.git
cd php-psr
phpize
./configure --with-php-config=/usr/bin/php-config
sudo make install
sudo echo /etc/php/conf.d/psr.ini

extension=psr.so

Compile Zephir Parser
pacman -Ss re2c
git clone git://github.com/phalcon/php-zephir-parser.git
cd php-zephir-parser
phpize
./configure --with-php-config=/usr/bin/php-config
sudo make install
sudo vim /etc/php/conf.d/zephir_parser.ini

[Zephir Parser]
extension=zephir_parser.so

Compile Phalcon
git clone --depth=1 "git://github.com/phalcon/cphalcon.git"
cd cphalcon
git fetch --all --tags
git checkout tags/v4.0.6
cd ../cphalcon
php ../zephir.phar fullclean
php ../zephir.phar build
vim /etc/php/conf.d/phalcon.ini

extension=phalcon.so

@Caffe1neAdd1ct
Copy link
Author

Caffe1neAdd1ct commented Sep 6, 2020

Also i've no idea on the Scrutinizer error:

https://api.bitbucket.org/1.0/repositories/fabfuel/mongo/tags

{"type": "error", "error": {"message": "Resource removed", "detail": "This API is no longer supported.\n\nFor information about its removal, please refer to the deprecation notice at: https://developer.atlassian.com/cloud/bitbucket/deprecation-notice-v1-apis/"}}

Change to

https://api.bitbucket.org/2.0/repositories/fabfuel/mongo/refs/tags

Guessing this is being caused by an out of date version of Composer... they moved from bitbucket api v1 in about v1.8.4

@Caffe1neAdd1ct
Copy link
Author

So i think the conclusion here is to support Phalcon 4 we to fix the build and upgrade the composer phar being used with a simple composer self-update included in the build.

@fabfuel
Copy link
Owner

fabfuel commented Sep 8, 2020

Great, thanks! I will have a look at the Scrutinizer issue

@iamveecee
Copy link

I also faced the same issue. The purposed solution by @Caffe1neAdd1ct is correct. @fabfuel Could you please merge it.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants