Added capability to merge organisations
- Added an interface for organisation - Added beforeDelete and beforeMerge callbacks - Added hard/soft delete to organisations
This commit is contained in:
@@ -12,6 +12,7 @@ namespace UserFrosting\Sprinkle\Organisations\ServicesProvider;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use UserFrosting\Sprinkle\Organisations\Database\Models\Interfaces\OrganisationInterface as OrganisationInterface;
|
||||
|
||||
/**
|
||||
* Registers services for the organisation sprinkle.
|
||||
@@ -40,5 +41,44 @@ class ServicesProvider
|
||||
|
||||
return $classMapper;
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* Returns a callback that handles merging any organisation objects.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
$container['organisation.beforeMerge'] = function ($c) {
|
||||
/*
|
||||
* This method is invoked when an organisation is about to be merged
|
||||
*
|
||||
* Returns a callback that handles re-owning any organisation objects.
|
||||
* Throwing exceptions is allowed but not recommended. This method is triggered within a Capsule context.
|
||||
* @param \UserFrosting\Sprinkle\Organisations\Database\Models\Interfaces\OrganisationInterfaces $source Organisation merging from
|
||||
* @param \UserFrosting\Sprinkle\Organisations\Database\Models\Interfaces\OrganisationInterfaces $target Organisation merging towards
|
||||
*/
|
||||
return function (OrganisationInterface $source, OrganisationInterface $target) use ($c) {
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns a callback that handles hard deleting an organisation (clean up any associated objects).
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
$container['organisation.beforeDelete'] = function ($c) {
|
||||
/*
|
||||
* This method is invoked when an organisation is about to be merged
|
||||
*
|
||||
* Returns a callback that handles re-owning any organisation objects.
|
||||
* Throwing exceptions is allowed but not recommended. This method is triggered within a Capsule context.
|
||||
* @param \UserFrosting\Sprinkle\Organisations\Database\Models\Interfaces\OrganisationInterfaces $organisation Organisation about to be deleted
|
||||
*/
|
||||
return function (OrganisationInterface $organisation) use ($c) {
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user