BCard - Documentation technique

Subscription
in package

Abonnement d'un utilisateur, éventuellement porté par une entreprise, à un plan tarifaire.

Un abonnement appartient à un utilisateur unique (User, obligatoire), rattaché à un plan unique (Plan, obligatoire) et, en option, à une entreprise (Company) quand la souscription est portée par un compte professionnel. status prend l'une des valeurs ACTIVE, CANCELLED, EXPIRED ou PENDING (constantes STATUS_*), initialisée à PENDING au constructeur ; billingCycle prend MONTHLY ou YEARLY (constantes BILLING_*). isActive(), isCancelled() et isExpired() sont des champs dérivés calculés à partir de status et, pour l'expiration, également de la comparaison de endDate à l'instant présent. getRemainingDays() est calculé à partir de endDate (nombre de jours restants, 0 si dépassée, null si endDate n'est pas renseignée). getFormattedAmount() formate amount en francs guinéens (GNF). Les méthodes cancel() et activate() modifient status (et cancelledAt/cancellationReason pour la première) ainsi que updatedAt, sans effectuer elles-mêmes de persistance. stripeSubscriptionId n'est renseigné que pour les abonnements facturés via Stripe.

Attributes
#[Entity]
$repositoryClass: \App\Repository\SubscriptionRepository::class

Table of Contents

Constants

BILLING_MONTHLY  : mixed = 'MONTHLY'
BILLING_YEARLY  : mixed = 'YEARLY'
STATUS_ACTIVE  : mixed = 'ACTIVE'
STATUS_CANCELLED  : mixed = 'CANCELLED'
STATUS_EXPIRED  : mixed = 'EXPIRED'
STATUS_PENDING  : mixed = 'PENDING'

Properties

$amount  : string|null
$autoRenew  : bool|null
$billingCycle  : string|null
$cancellationReason  : string|null
$cancelledAt  : DateTimeImmutable|null
$company  : Company|null
$createdAt  : DateTimeImmutable|null
$endDate  : DateTimeImmutable|null
$id  : int|null
$nextBillingDate  : DateTimeImmutable|null
$plan  : Plan|null
$startDate  : DateTimeImmutable|null
$status  : string|null
$stripeSubscriptionId  : string|null
$updatedAt  : DateTimeImmutable|null
$user  : User|null

Methods

__construct()  : mixed
activate()  : static
cancel()  : static
getAmount()  : string|null
getBillingCycle()  : string|null
getCancellationReason()  : string|null
getCancelledAt()  : DateTimeImmutable|null
getCompany()  : Company|null
getCreatedAt()  : DateTimeImmutable|null
getEndDate()  : DateTimeImmutable|null
getFormattedAmount()  : string
getId()  : int|null
getNextBillingDate()  : DateTimeImmutable|null
getPlan()  : Plan|null
getRemainingDays()  : int|null
getStartDate()  : DateTimeImmutable|null
getStatus()  : string|null
getStripeSubscriptionId()  : string|null
getUpdatedAt()  : DateTimeImmutable|null
getUser()  : User|null
isActive()  : bool
isAutoRenew()  : bool|null
isCancelled()  : bool
isExpired()  : bool
setAmount()  : static
setAutoRenew()  : static
setBillingCycle()  : static
setCancellationReason()  : static
setCancelledAt()  : static
setCompany()  : static
setCreatedAt()  : static
setEndDate()  : static
setNextBillingDate()  : static
setPlan()  : static
setStartDate()  : static
setStatus()  : static
setStripeSubscriptionId()  : static
setUpdatedAt()  : static
setUser()  : static

Constants

BILLING_MONTHLY

public mixed BILLING_MONTHLY = 'MONTHLY'

STATUS_CANCELLED

public mixed STATUS_CANCELLED = 'CANCELLED'

Properties

$amount

private string|null $amount = null
Attributes
#[Column]
$type: \Doctrine\DBAL\Types\Types::DECIMAL
$precision: 10
$scale: 2

$autoRenew

private bool|null $autoRenew = true
Attributes
#[Column]
$nullable: true

$billingCycle

private string|null $billingCycle = null
Attributes
#[Column]
$length: 20

$cancellationReason

private string|null $cancellationReason = null
Attributes
#[Column]
$length: 255
$nullable: true

$cancelledAt

private DateTimeImmutable|null $cancelledAt = null
Attributes
#[Column]
$nullable: true

$company

private Company|null $company = null
Attributes
#[JoinColumn]
$nullable: true
#[ManyToOne]
$targetEntity: \App\Entity\Company::class
$inversedBy: 'subscriptions'

$createdAt

private DateTimeImmutable|null $createdAt = null
Attributes
#[Column]

$endDate

private DateTimeImmutable|null $endDate = null
Attributes
#[Column]
$nullable: true

$id

private int|null $id = null
Attributes
#[Column]
#[GeneratedValue]
#[Id]

$nextBillingDate

private DateTimeImmutable|null $nextBillingDate = null
Attributes
#[Column]
$nullable: true

$plan

private Plan|null $plan = null
Attributes
#[JoinColumn]
$nullable: false
#[ManyToOne]
$inversedBy: 'subscriptions'

$startDate

private DateTimeImmutable|null $startDate = null
Attributes
#[Column]

$status

private string|null $status = null
Attributes
#[Column]
$length: 20

$stripeSubscriptionId

private string|null $stripeSubscriptionId = null
Attributes
#[Column]
$length: 255
$nullable: true

$updatedAt

private DateTimeImmutable|null $updatedAt = null
Attributes
#[Column]

$user

private User|null $user = null
Attributes
#[JoinColumn]
$nullable: false
#[ManyToOne]
$inversedBy: 'subscriptions'

Methods

activate()

public activate() : static
Return values
static

cancel()

public cancel([string $reason = null ]) : static
Parameters
$reason : string = null
Return values
static

getAmount()

public getAmount() : string|null
Return values
string|null

getBillingCycle()

public getBillingCycle() : string|null
Return values
string|null

getCancellationReason()

public getCancellationReason() : string|null
Return values
string|null

getCancelledAt()

public getCancelledAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getCreatedAt()

public getCreatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getEndDate()

public getEndDate() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getFormattedAmount()

public getFormattedAmount() : string
Return values
string

getId()

public getId() : int|null
Return values
int|null

getNextBillingDate()

public getNextBillingDate() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getRemainingDays()

public getRemainingDays() : int|null
Return values
int|null

getStartDate()

public getStartDate() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

getStatus()

public getStatus() : string|null
Return values
string|null

getStripeSubscriptionId()

public getStripeSubscriptionId() : string|null
Return values
string|null

getUpdatedAt()

public getUpdatedAt() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

isAutoRenew()

public isAutoRenew() : bool|null
Return values
bool|null

isCancelled()

public isCancelled() : bool
Return values
bool

isExpired()

public isExpired() : bool
Return values
bool

setAmount()

public setAmount(string $amount) : static
Parameters
$amount : string
Return values
static

setAutoRenew()

public setAutoRenew(bool|null $autoRenew) : static
Parameters
$autoRenew : bool|null
Return values
static

setBillingCycle()

public setBillingCycle(string $billingCycle) : static
Parameters
$billingCycle : string
Return values
static

setCancellationReason()

public setCancellationReason(string|null $cancellationReason) : static
Parameters
$cancellationReason : string|null
Return values
static

setCancelledAt()

public setCancelledAt(DateTimeImmutable|null $cancelledAt) : static
Parameters
$cancelledAt : DateTimeImmutable|null
Return values
static

setCreatedAt()

public setCreatedAt(DateTimeImmutable $createdAt) : static
Parameters
$createdAt : DateTimeImmutable
Return values
static

setEndDate()

public setEndDate(DateTimeImmutable|null $endDate) : static
Parameters
$endDate : DateTimeImmutable|null
Return values
static

setNextBillingDate()

public setNextBillingDate(DateTimeImmutable|null $nextBillingDate) : static
Parameters
$nextBillingDate : DateTimeImmutable|null
Return values
static

setPlan()

public setPlan(Plan|null $plan) : static
Parameters
$plan : Plan|null
Return values
static

setStartDate()

public setStartDate(DateTimeImmutable $startDate) : static
Parameters
$startDate : DateTimeImmutable
Return values
static

setStatus()

public setStatus(string $status) : static
Parameters
$status : string
Return values
static

setStripeSubscriptionId()

public setStripeSubscriptionId(string|null $stripeSubscriptionId) : static
Parameters
$stripeSubscriptionId : string|null
Return values
static

setUpdatedAt()

public setUpdatedAt(DateTimeImmutable $updatedAt) : static
Parameters
$updatedAt : DateTimeImmutable
Return values
static

setUser()

public setUser(User|null $user) : static
Parameters
$user : User|null
Return values
static

        
On this page

Search results