Giter VIP home page Giter VIP logo

Comments (7)

agaleski avatar agaleski commented on May 13, 2024 1

Use this

public function beforeFilter(Event $event)
{
    $this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get']);
    $this->loadModel('Articles', 'Endpoint');
}

I have tested it at a fresh installation of CakePhp 3.3.4
You have to add the line
$this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'get']);
or you run into the initial described error in this issue.

May be the README.md should be updated.

from webservice.

agaleski avatar agaleski commented on May 13, 2024

Possible quick fix.

try using this:
$this->modelFactory('Endpoint', ['Muffin\Webservice\Model\EndpointRegistry', 'factory']);

I do not have enough details to check or try it. Hope this helps.

from webservice.

avt00 avatar avt00 commented on May 13, 2024

Thanks for the reply!
Unfortunately it shows the same error: "Argument 2 passed to Cake\Controller\Controller::modelFactory() must be callable, array given"
May be I did something wrong installing this package.

Please tell me what details you need. I can put the whole test project on the GitHub if it can help.

from webservice.

agaleski avatar agaleski commented on May 13, 2024

Which CakePhp Version do you use?
Have you added the plugin via composer require ?
Does your bootstrap.php contain this line:
Plugin::load('Muffin/Webservice', ['bootstrap' => true]);
?

from webservice.

avt00 avatar avt00 commented on May 13, 2024
  1. CakePHP version is 3.3.4
  2. Yes. I have the plugin added via composer require
  3. Yes

from webservice.

avt00 avatar avt00 commented on May 13, 2024

Thank you! Problem solved.

from webservice.

davidyell avatar davidyell commented on May 13, 2024

Just hit this also myself. Perhaps the documentation needs updating to include this?

from webservice.

Related Issues (20)

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.