Giter Site home page Giter Site logo

php-casbin / dbal-adapter Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 4.0 25 KB

Doctrine DBAL Adapter for Casbin, Casbin is a powerful and efficient open-source access control library.

License: Apache License 2.0

PHP 100.00%
casbin rbac permission acl adapter dbal database

dbal-adapter's Issues

Error loading policy during instantiation

I get this error when trying to instantiate the Enforcer class using this adapter:

TypeError:
Argument 1 passed to CasbinAdapter\DBAL\Adapter::fetch() must be an instance of Doctrine\DBAL\Result, instance of Doctrine\DBAL\Driver\PDOStatement given, called in /<redacted>/vendor/casbin/dbal-adapter/src/Adapter.php on line 153

  at /<redacted>/vendor/casbin/dbal-adapter/src/Adapter.php:495
  at CasbinAdapter\DBAL\Adapter->fetch(object(PDOStatement))
     (/<redacted>/vendor/casbin/dbal-adapter/src/Adapter.php:153)
  at CasbinAdapter\DBAL\Adapter->loadPolicy(object(Model))
     (/<redacted>/vendor/casbin/casbin/src/CoreEnforcer.php:363)
  at Casbin\CoreEnforcer->loadPolicy()
     (/<redacted>/vendor/casbin/casbin/src/CoreEnforcer.php:223)
  at Casbin\CoreEnforcer->initWithModelAndAdapter(object(Model), object(Adapter))
     (/<redacted>/vendor/casbin/casbin/src/CoreEnforcer.php:198)
  at Casbin\CoreEnforcer->initWithAdapter('/<redacted>/permission_model.conf', object(Adapter))
     (/<redacted>/vendor/casbin/casbin/src/CoreEnforcer.php:150)
  at Casbin\CoreEnforcer->__construct('/<redacted>/resources/permission_model.conf', object(Adapter))
     (/<redacted>/src/Utilities/Permission.php:52)

From the composer.json file in this library, Doctrine 2.9 and 3.0 are supported. I am using Doctrine 2.9.3.

Digging through the source code, it looks like the execute method from DBAL Query Builder (called on line 151 in Adapter.php) returns a ResultStatement rather than the expected Result object.

Passing an array of parameters instead of a Connection object in the constructor produces the same result. Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.