xiaohutai / jsonapi

[Bolt Extension] JSON API for Bolt CMS
https://market.bolt.cm/view/bolt/jsonapi
MIT License
55 stars 18 forks source link

Major refactoring #12

Closed DennisSnijder closed 8 years ago

DennisSnijder commented 8 years ago

Refactored Extension.php into separate Controllers, Helpers and ServiceProviders.

bobdenotter commented 8 years ago

Pinging @xiaohutai Don't forget about this one. ;-)

DennisSnijder commented 8 years ago

Bump @xiaohutai

xiaohutai commented 8 years ago

@DennisSnijder

Sorry for testing this so late... I've been out of the Bolt loop for a bit.

Regarding your extension, I keep getting:

Class 'Bolt\Extension\Bolt\JsonApi\Provider\APIProvider' not found

both with testing locally in extensions/local/bolt/jsonapi/ and making a test test-pull-request branch and installing it with stability set to dev (in config.yml).

I've also tried adding [ "", "src/" ] in the extension's composer.json and then composer dumpautoload in the ./extensions/ folder, but that doesn't seem to fix it for me.

The older versions do still work for me though.

jasperjorna commented 8 years ago

Same problem here, any updates on this?

Raistlfiren commented 8 years ago

This fork does work. I haven't been able to test any other calls other than just doing /json/pages. BOLT doesn't automatically update the installed.json file under the extensions directory if you screw up your composer.json and try to do dump-autoload. You must manually add that to the installed.json file in the composer directory.

That aside, I did have to change a few other things to get it working. I am going to try to test it some more tonight and see where I can get it. In order to get it fully working, you need to update the UtilityHelper to look like the following and update ApiResponse setContent to accept the same arguments as the Response hint change array $content to $content.

  /**
     * @param string $filename
     * @return string
     */
    public function makeAbsolutePathToThumbnail($filename = '')
    {
        $config = $this->app['extensions']->getEnabled()['JSON API']->getConfig();
        return sprintf('%s/thumbs/%sx%s/%s',
            $this->app['paths']['canonical'],
            $config['thumbnail']['width'],
            $config['thumbnail']['height'],
            $filename
        );
    }
xiaohutai commented 8 years ago

OK, it seems to work if I add the [ "", "src/" ] fix in composer.json.