mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-11 17:39:41 +00:00
refactor: inject ExpressionLanguage singleton using DI
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
@@ -69,9 +70,11 @@ use FireflyIII\Support\Preferences;
|
||||
use FireflyIII\Support\Steam;
|
||||
use FireflyIII\TransactionRules\Engine\RuleEngineInterface;
|
||||
use FireflyIII\TransactionRules\Engine\SearchRuleEngine;
|
||||
use FireflyIII\TransactionRules\Expressions\ActionExpressionLanguageProvider;
|
||||
use FireflyIII\Validation\FireflyValidator;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
|
||||
|
||||
/**
|
||||
* Class FireflyServiceProvider.
|
||||
@@ -200,6 +203,16 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
}
|
||||
);
|
||||
|
||||
// rule expression language
|
||||
$this->app->singleton(
|
||||
ExpressionLanguage::class,
|
||||
static function () {
|
||||
$expressionLanguage = new ExpressionLanguage();
|
||||
$expressionLanguage->registerProvider(new ActionExpressionLanguageProvider());
|
||||
return $expressionLanguage;
|
||||
}
|
||||
);
|
||||
|
||||
$this->app->bind(
|
||||
RuleEngineInterface::class,
|
||||
static function (Application $app) {
|
||||
|
||||
Reference in New Issue
Block a user