BConnect Business - Reference PHP

PricingPlanController extends AbstractController
in package

Attributes
#[IsGranted]
'ROLE_SUPPORT'
#[Route]
'/pricing/plan'

Table of Contents

Methods

delete()  : Response
Deletes a PricingPlan entity.
edit()  : Response
Edit an existing PricingPlan entity.
index()  : Response
Displays a list of pricing plans.
new()  : Response
Creates a new PricingPlan entity.

Methods

delete()

Deletes a PricingPlan entity.

public delete(Request $request, PricingPlan $pricingPlan, EntityManagerInterface $entityManager) : Response

This method handles the deletion of a PricingPlan entity. It validates the CSRF token to ensure the request is legitimate. If the token is valid, the PricingPlan entity is removed from the database using the EntityManager and the changes are flushed. After deletion, the user is redirected to the pricing plan index page.

Parameters
$request : Request

The HTTP request object.

$pricingPlan : PricingPlan

The PricingPlan entity to be deleted.

$entityManager : EntityManagerInterface

The entity manager for handling database operations.

Attributes
#[Route]
'/{id}'
$name: 'app_pricing_plan_delete'
$methods: ['POST']
Return values
Response

The HTTP response object, redirecting to the pricing plan index page.

edit()

Edit an existing PricingPlan entity.

public edit(Request $request, PricingPlan $pricingPlan, EntityManagerInterface $entityManager, PosFeatureRepository $posFeatureRepository) : Response

This method handles the editing of a PricingPlan entity. It creates and processes a form for the PricingPlan, updates its features based on the submitted data, and persists the changes to the database.

Parameters
$request : Request

The current request instance.

$pricingPlan : PricingPlan

The PricingPlan entity to be edited.

$entityManager : EntityManagerInterface

The entity manager for database operations.

$posFeatureRepository : PosFeatureRepository

Repository for POS features.

Attributes
#[Route]
'/{id}/edit'
$name: 'app_pricing_plan_edit'
$methods: ['GET', 'POST']
Return values
Response

The response object, either rendering the edit form or redirecting to the index page.

index()

Displays a list of pricing plans.

public index(PricingPlanRepository $pricingPlanRepository) : Response

This method handles the GET request to the root URL ('/') and retrieves all pricing plans from the PricingPlanRepository, ordered by their ID in descending order. The retrieved pricing plans are then passed to the 'pricing_plan/index.html.twig' template for rendering.

Parameters
$pricingPlanRepository : PricingPlanRepository

The repository to fetch pricing plans from.

Attributes
#[Route]
'/'
$name: 'app_pricing_plan_index'
$methods: ['GET']
Return values
Response

The response object containing the rendered template.

new()

Creates a new PricingPlan entity.

public new(Request $request, EntityManagerInterface $entityManager, PosFeatureRepository $posFeatureRepository) : Response

This method handles the creation of a new PricingPlan entity. It processes the form submission, validates the data, and persists the new PricingPlan along with its associated features to the database.

Parameters
$request : Request

The HTTP request object.

$entityManager : EntityManagerInterface

The entity manager for database operations.

$posFeatureRepository : PosFeatureRepository

Repository for POS features.

Attributes
#[Route]
'/new'
$name: 'app_pricing_plan_new'
$methods: ['GET', 'POST']
Return values
Response

The HTTP response object.

On this page

Search results