{"action":"created","issue":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/22","repository_url":"https://api.github.com/repos/adonisjs/adonis-lucid","labels_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/22/comments","events_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/22/events","html_url":"https://github.com/adonisjs/adonis-lucid/issues/22","id":135396616,"number":22,"title":"Problems while extending classes inside services","user":{"login":"rbartholomay","id":1138142,"avatar_url":"https://avatars.githubusercontent.com/u/1138142?v=3","gravatar_id":"","url":"https://api.github.com/users/rbartholomay","html_url":"https://github.com/rbartholomay","followers_url":"https://api.github.com/users/rbartholomay/followers","following_url":"https://api.github.com/users/rbartholomay/following{/other_user}","gists_url":"https://api.github.com/users/rbartholomay/gists{/gist_id}","starred_url":"https://api.github.com/users/rbartholomay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbartholomay/subscriptions","organizations_url":"https://api.github.com/users/rbartholomay/orgs","repos_url":"https://api.github.com/users/rbartholomay/repos","events_url":"https://api.github.com/users/rbartholomay/events{/privacy}","received_events_url":"https://api.github.com/users/rbartholomay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-02-22T11:57:54Z","updated_at":"2016-02-22T14:37:07Z","closed_at":null,"body":"Hi,\r\n\r\ni have problems with extend classes with services. I use many classes which extended from BaseBMC which is also extend from BaseRemote. I cannot find the reason for my problem and thought this *can* be a problem in Lucid. \r\n\r\nAll classes/services will be called scheduled. Each service called the \"_getCredentialsObject_\" in BaseRemote - sometimes exactly the same time.\r\nEvery _getCredentialsObject_-call will be successful, the result is always a valid credentialobject in the console output of BaseRemote.\r\nBut i the class TicketService sometimes the credentialobject is false.\r\n\r\nWhere is my fault?\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst Database = use('Database');                 \r\nconst SysLogins = use('App/Model/SysLogins');     \r\nconst SysLoginsLogs = use('App/Model/SysLoginsLogs');  \r\nconst Helpers = use('Helpers');\r\n\r\nconst _ = require('lodash');              \r\nconst CatLog  = require('cat-log');             \r\n\r\n\r\nclass BaseRemote {\r\n\r\n  constructor (prop) {\r\n    this.prop = prop;\r\n\r\n    this.log = new CatLog(prop.logCat || 'BaseRemote-Service');\r\n\r\n    this.storagePath = Helpers.storagePath();\r\n    this.storeLastResult = prop.storeLastResult || false;\r\n    this.Database = Database;\r\n    this.sysLogins = SysLogins;\r\n    this.sysLoginsLogs = SysLoginsLogs;\r\n    this.helpers = Helpers;\r\n    this._ = _;\r\n  }\r\n\r\n  * getCredentialsObject (system){\r\n    var cObj = yield this.sysLogins.new().where('name', '=', system).first().fetch();  // must use new()!!!\r\n    if (!cObj.size()) {\r\n      throw new Error('System credentials not available');\r\n    }\r\n\r\n    cObj = cObj.toJSON();\r\n\r\n    if (!cObj.enabled) {\r\n      return false;\r\n    }\r\n\r\n    console.log('BaseRemote', cObj);    //   <---   here every call is ok\r\n    return cObj;\r\n  }\r\n}\r\n\r\nmodule.exports = BaseRemote;\r\n```\r\n\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst BaseRemote = use('App/Services/BaseRemote');\r\nclass BaseBMC extends BaseRemote {\r\n\r\n  * execute (title, options, sql) {\r\n    let me = this;\r\n\r\n    return new Promise(function (resolve, reject)  \r\n        resolve([{\r\n\t    foo : 'bar'\r\n\t}]);\r\n    });\r\n  }\r\n  // [...]\r\n}\r\n\r\nmodule.exports = BaseBMC;\r\n```\r\n\r\n```javascript\r\n'use strict';\r\n\r\nconst BaseBMC = use('App/Services/BaseBMC');\r\n\r\nclass TicketService extends BaseBMC {\r\n\r\n  constructor () {\r\n    // [...]\r\n    super(prop);\r\n  }\r\n\r\n  * getTickets() {\r\n    var me = this,\r\n        sql,\r\n        credentialsObject;\r\n\r\n    credentialsObject = yield me.getCredentialsObject('TicketService');    \r\n    console.log('TicketService', credentialsObject);    // <--- sometime false\t\r\n    if (!credentialsObject) {\r\n      me.log.info('credentials not available or systemservice not enabled');\r\n      return [];\r\n    }\r\n\r\n\r\n    return true\r\n  }\r\n}\r\n\r\nmodule.exports = TicketService;\r\n```"},"comment":{"url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/comments/187207666","html_url":"https://github.com/adonisjs/adonis-lucid/issues/22#issuecomment-187207666","issue_url":"https://api.github.com/repos/adonisjs/adonis-lucid/issues/22","id":187207666,"user":{"login":"thetutlage","id":1706381,"avatar_url":"https://avatars.githubusercontent.com/u/1706381?v=3","gravatar_id":"","url":"https://api.github.com/users/thetutlage","html_url":"https://github.com/thetutlage","followers_url":"https://api.github.com/users/thetutlage/followers","following_url":"https://api.github.com/users/thetutlage/following{/other_user}","gists_url":"https://api.github.com/users/thetutlage/gists{/gist_id}","starred_url":"https://api.github.com/users/thetutlage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thetutlage/subscriptions","organizations_url":"https://api.github.com/users/thetutlage/orgs","repos_url":"https://api.github.com/users/thetutlage/repos","events_url":"https://api.github.com/users/thetutlage/events{/privacy}","received_events_url":"https://api.github.com/users/thetutlage/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T14:37:07Z","updated_at":"2016-02-22T14:37:07Z","body":"ohhh you mean the query is returning nothing, i agree and identified it as a bug.\r\n\r\nworking on a different branch to sort out these issues, may be you gotta wait for sometime 😞"}}