November's Paddleball Marathon


    0.1.7 • Public • Published


    Extension package for the ee-orm package. You should inherit from this package if you're creating an extension for the ee-orm package.


    npm install ee-orm-extension

    build status

    Build Status


    Basically you can inherit from this class, it will provides some basic methods & functions required for wrting an extension for the orm

    var   Class         = require('ee-class')
        , ORMExtension  = require('ee-orm-extension');
    var MyFancyORMExtension = new Class({
        inherits: ORMExtension
        // class constructor
        , init: function(options) {

    You can listen for events that are emitted by the model instances or the resource object (this is used for building select quieries). You can also inject methods into the models and the querbuilders prototype.

    extending the model / querybuilder

    if the extension needs to place methods on the models or the querybuilders prototype it needs to expose this functions


    this function gets the models definition and the models classdefintion as arguments, it may attach own methods to the models definition

    applyModelMethods: function(definition, classDefinition) {
        classDefinition.doSomeFanyStuff = function() {


    this function gets the models definition and the querybuilders classdefintion as arguments, it may attach own methods to the querybuilders definition

    applyQueryBuilderMethods: function(definition, classDefinition) {
        classDefinition.doSomeFanyStuff = function() {

    Events on the model instance

    If you are going to listen to events you have to define listeners on your extension. If you are going to listen to the beforeSave event you have to define a method onBeforeSave on your extension.

    • beforeSave

    • afterSave

    • afterSaveCommit

    • beforeDelete

    • afterDelete

    • afterDeleteCommit

    • beforeInsert

    • afterInsert

    • beforeUpdate

    • afterUpdate

    • beforeSaveDependents

    • afterSaveDependents

    • beforeSaveBelongsTo

    • afterSaveBelongsTo

    • beforeSaveMappings

    • bafterSaveMappings

    • beforeSaveRefernces

    • afterSaveRefernces

    Events on the querybuilder

    • beforePrepare

    • afterPrepare

    • beforePrepareSubqueries

    • afterPrepareSubqueries


    npm i ee-orm-extension

    DownloadsWeekly Downloads






    Last publish


    • ee