From 1b7e1b9e6a7abb3c3f2a0a30741eaa78aeffe31d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Georget?= Date: Tue, 5 Jul 2016 14:32:50 +0200 Subject: [PATCH] Waiting knex fired event before load bookshelf --- packages/strapi-bookshelf/lib/index.js | 14 +++++++------- .../configuration/hooks/dictionary/_hooks/index.js | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/strapi-bookshelf/lib/index.js b/packages/strapi-bookshelf/lib/index.js index 04c95f50cc..f8efe63b2d 100755 --- a/packages/strapi-bookshelf/lib/index.js +++ b/packages/strapi-bookshelf/lib/index.js @@ -37,16 +37,16 @@ module.exports = function (strapi) { initialize: function (cb) { let globalName; - // Make sure the Knex hook is present since Knex needs it. - if (!strapi.hooks.knex) { - strapi.log.error('Impossible to load the ORM without the query builder!'); - strapi.log.error('You need to install the Strapi query builder with `$ npm install strapi-knex --save`.'); - strapi.stop(1); - } - // Only run this logic after the Knex has finished to load. strapi.after('hook:knex:loaded', function () { + // Make sure the Knex hook is present since Knex needs it. + if (!strapi.hooks.external.knex) { + strapi.log.error('Impossible to load the ORM without the query builder!'); + strapi.log.error('You need to install the Strapi query builder with `$ npm install strapi-knex --save`.'); + strapi.stop(1); + } + // Initialize collections _.set(strapi, 'bookshelf.collections', {}); diff --git a/packages/strapi/lib/configuration/hooks/dictionary/_hooks/index.js b/packages/strapi/lib/configuration/hooks/dictionary/_hooks/index.js index a2d1bb7d6e..64819ca0c8 100644 --- a/packages/strapi/lib/configuration/hooks/dictionary/_hooks/index.js +++ b/packages/strapi/lib/configuration/hooks/dictionary/_hooks/index.js @@ -63,6 +63,7 @@ module.exports = function (strapi) { cb(err); } } + return memo; }, {}));