Category : service

my application is multilinguage and i can enable/disable language into bdd table from backoffice, but with app_locales declaration array from services.yaml, i can’t dynamically add or remove lang. so first i want to replace services.yaml with services.php to declare app_locales as : <?php namespace SymfonyComponentDependencyInjectionLoaderConfigurator; use AppSecurityCustomInterface; use PsrLogLoggerInterface; use SymfonyComponentDependencyInjectionDefinition; use SymfonyComponentDependencyInjectionReference; return static ..

Read more

how can I convert this into laravel in a service with paternal factory design? For example in this controller to have only a validation and sending the data in the route? namespace AppHttpControllers; use IlluminateHttpRequest; use LeagueCsvReader; use DB; class ConvertController extends Controller { public function convert(Request $request) { switch($request->query(‘source’)) { case ‘csv’: $csv = ..

Read more

I have problem with service container in Symfony 5. I have basic class CoreModel and I want use it in base controller, that everyone has access to it. namespace AppModel; use AppModelCoreCodeModel; class CounterModel { } My call in controller: $this->get(‘model.counter’); I added to services.yml this connection services: App: resource: ‘../src/*’ exclude: ‘../src/{DependencyInjection,Utils,Service,Model,Entity,Migrations,Tests,Form, Validatior, Kernel.php}’ ..

Read more

I’m trying to create a bundle in my symfony 5 project. I followed the documentation of symfony to create the bundle. The routing and controllers works fine. Bundle config file: mybundle: email_game_notifier: noreply_address: "[email protected]" receiver_address: "[email protected]" I added the bundle in bundles.php return [ … AppMyBundleMyBundle::class => [‘all’ => true], ]; I created a DependencyInjection ..

Read more

i need helper in another helper ci4, but not working like ci3 error code : Call to undefined function get_instance(), i readed ci4 doc. service but i do not understand function file_upload(){ $ci = & get_instance(); $ci->load->helper(‘form’); $input = $ci->validate([ ‘file’ => [ ‘uploaded[file]’, ‘max_size[file,1024]’, ] ]); if (!$input) { print_r(‘Choose a valid file’); }} ..

Read more

I am trying to make my session variables be destroyed on logout. Calling of php scrips is happening in my api.service.ts script. The page that this is happening on is being run from app.component.html. <button type="button" *ngIf="logoutbtn" class="btn btn-block" (click)="logout()">logout</button> is calling the logout() function from my app.component.ts script. logout() { this.dataService.deleteToken(); // Close session ..

Read more

I was told to change my project so it would use services instead of entity menager. I don’t really know how to do that and I would really appreciate any help. Controller: /** * @Route("/new", name="action_new", methods={"GET","POST"}) */ public function new(Request $request): Response { $actionRepository = $this->getDoctrine() ->getManager() ->getRepository(‘App:Action’); $walletRepository = $this->getDoctrine() ->getManager() ->getRepository(‘App:Wallet’); $action ..

Read more