public static function lazyRelatedOperation(array $kwargs)
    {
        /** @var $scopeModel Model */
        $callback = ArrayHelper::pop($kwargs, 'callable');
        $scopeModel = ArrayHelper::pop($kwargs, 'scopeModel');
        $relModel = ArrayHelper::pop($kwargs, 'relatedModel');

        $relModel = self::resolveRelation($scopeModel, $relModel);

        $relModels = (array) $relModel;

        $modelsToResolve = [];
        foreach ($relModels as $relM) {
            if (is_string($relM)) {
                $modelsToResolve[] = $relM;
            } elseif ($relM instanceof Model) {
                $modelsToResolve[] = $relM->getMeta()->getNSModelName();
            }
        }

        $kwargs['scopeModel'] = $scopeModel;
        $scopeModel->getMeta()->getRegistry()
            ->lazyModelOps($callback, $modelsToResolve, $kwargs);
    }
public static function lazyRelatedOperation(array $kwargs)
    {
        /** @var $scopeModel Model */
        $callback = ArrayHelper::pop($kwargs, 'callable');
        $scopeModel = ArrayHelper::pop($kwargs, 'scopeModel');
        $relModel = ArrayHelper::pop($kwargs, 'relatedModel');

        $relModel = self::resolveRelation($scopeModel, $relModel);

        $relModels = (array) $relModel;

        $modelsToResolve = [];
        foreach ($relModels as $relM) {
            if (is_string($relM)) {
                $modelsToResolve[] = $relM;
            } elseif ($relM instanceof Model) {
                $modelsToResolve[] = $relM->getMeta()->getNSModelName();
            }
        }

        $kwargs['scopeModel'] = $scopeModel;
        $scopeModel->getMeta()->getRegistry()
            ->lazyModelOps($callback, $modelsToResolve, $kwargs);
    }
public static function lazyRelatedOperation ( array $ kwargs ) { /** @var $scopeModel Model */ $ callback = ArrayHelper :: pop ( $ kwargs , 'callable' ) ; $ scopeModel = ArrayHelper :: pop ( $ kwargs , 'scopeModel' ) ; $ relModel = ArrayHelper :: pop ( $ kwargs , 'relatedModel' ) ; $ relModel = self :: resolveRelation ( $ scopeModel , $ relModel ) ; $ relModels = ( array ) $ relModel ; $ modelsToResolve = [ ] ; foreach ( $ relModels as $ relM ) { if ( is_string ( $ relM ) ) { $ modelsToResolve [ ] = $ relM ; } elseif ( $ relM instanceof Model ) { $ modelsToResolve [ ] = $ relM -> getMeta ( ) -> getNSModelName ( ) ; } } $ kwargs [ 'scopeModel' ] = $ scopeModel ; $ scopeModel -> getMeta ( ) -> getRegistry ( ) -> lazyModelOps ( $ callback , $ modelsToResolve , $ kwargs ) ; }
Schedule `callback` to be called once `model` and all `related_models` have been imported
and registered with the app registry.

@param array $kwargs

- callable $callback   will be called with the newly-loaded model
classes as its optional keyword arguments
- Model    $scopeModel the model on which the method was invoked
- relatedModel   the related models that needs to be resolved
- fromField   the field that requires the relatedmodel to be resolved

@since  1.1.0

@author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>

@throws \Eddmash\PowerOrm\Exception\AppRegistryNotReady
@throws \Eddmash\PowerOrm\Exception\KeyError
Schedule callback to be called once model and all related_models have been imported and registered with the app registry .