Galette API documentation
Gestionnaire d’Adhérents en Ligne Extrêmement Tarabiscoté mais Tellement Efficace
1.0.0
Galette\Entity\ContributionsTypes Class Reference

Public Member Functions

 __construct (Db $zdb, int|ArrayObject $args=null)
 
 isExtension ()
 
 getAmount ()
 
 installInit ()
 
 getList (bool $extent=null)
 
 getCompleteList ()
 
 get (int $id)
 
 getLabel (int $id, bool $translated=true)
 
 getIdByLabel (string $label)
 
 add (string $label, ?float $amount, int $extension)
 
 update (int $id, string $label, ?float $amount, int $extension)
 
 delete (int $id)
 
 isUsed (int $id)
 
 __get (string $name)
 
 __isset (string $name)
 
 getErrors ()
 

Public Attributes

const DEFAULT_TYPE = -1
 
const DONATION_TYPE = 0
 
const TABLE = 'types_cotisation'
 
const PK = 'id_type_cotis'
 
const ID_NOT_EXITS = -1
 

Static Protected Attributes

static array $defaults
 

Constructor & Destructor Documentation

◆ __construct()

Galette\Entity\ContributionsTypes::__construct ( Db  $zdb,
int|ArrayObject  $args = null 
)

Default constructor

Parameters
Db$zdbDatabase
int|ArrayObject<string,int|string>|null$args Optional existing result set

Member Function Documentation

◆ __get()

Galette\Entity\ContributionsTypes::__get ( string  $name)

Global getter method

Parameters
string$namename of the property we want to retrieve
Returns
mixed the called property

◆ __isset()

Galette\Entity\ContributionsTypes::__isset ( string  $name)

Global isset method Required for twig to access properties via __get

Parameters
string$namename of the property we want to retrieve
Returns
bool

◆ add()

Galette\Entity\ContributionsTypes::add ( string  $label,
?float  $amount,
int  $extension 
)

Add a new entry

Parameters
string$labelThe label
?float$amount The amount
int$extensionMembership extension in months, 0 for a donation or -1 for preferences default
Returns
bool|integer -2 : label already exists

◆ delete()

Galette\Entity\ContributionsTypes::delete ( int  $id)

Delete entry

Parameters
integer$idEntry ID
Returns
self::ID_NOT_EXITS|boolean

◆ get()

Galette\Entity\ContributionsTypes::get ( int  $id)

Get an entry

Parameters
integer$idEntry ID
Returns
ArrayObject<string, int|string>|false Row if succeed ; false: no such id

◆ getAmount()

Galette\Entity\ContributionsTypes::getAmount ( )

Get the amount

Returns
float

◆ getCompleteList()

Galette\Entity\ContributionsTypes::getCompleteList ( )

Complete list

Returns
array<int, array<string,mixed>> of all objects

◆ getErrors()

Galette\Entity\ContributionsTypes::getErrors ( )

Get errors

Returns
array<string>

◆ getIdByLabel()

Galette\Entity\ContributionsTypes::getIdByLabel ( string  $label)

Get an ID from a label

Parameters
string$labelThe label
Returns
int|false Return id if it exists false otherwise

◆ getLabel()

Galette\Entity\ContributionsTypes::getLabel ( int  $id,
bool  $translated = true 
)

Get a label

Parameters
integer$idId
boolean$translatedDo we want translated or original label? Defaults to true.
Returns
string|int

◆ getList()

Galette\Entity\ContributionsTypes::getList ( bool  $extent = null)

Get list in an array built as: $array[id] = "translated label"

Parameters
boolean | null$extentFilter on (non) contributions types
Returns
array<int, array<string, mixed>>

◆ installInit()

Galette\Entity\ContributionsTypes::installInit ( )

Set defaults at install time

Returns
boolean
Exceptions
Throwable

◆ isExtension()

Galette\Entity\ContributionsTypes::isExtension ( )

Does current type give membership extension?

Returns
boolean

◆ isUsed()

Galette\Entity\ContributionsTypes::isUsed ( int  $id)

Check if this entry is used.

Parameters
integer$idEntry ID
Returns
boolean

◆ update()

Galette\Entity\ContributionsTypes::update ( int  $id,
string  $label,
?float  $amount,
int  $extension 
)

Update in database.

Parameters
integer$idEntry ID
string$labelThe label
?float$amount The amount
int$extensionMembership extension in months, 0 for a donation or -1 for preferences default
Returns
self::ID_NOT_EXITS|boolean

Member Data Documentation

◆ $defaults

array Galette\Entity\ContributionsTypes::$defaults
staticprotected
Initial value:
= array(
array('id' => 1, 'libelle' => 'annual fee', 'extension' => self::DEFAULT_TYPE),
array('id' => 2, 'libelle' => 'reduced annual fee', 'extension' => self::DEFAULT_TYPE),
array('id' => 3, 'libelle' => 'company fee', 'extension' => self::DEFAULT_TYPE),
array('id' => 4, 'libelle' => 'donation in kind', 'extension' => self::DONATION_TYPE),
array('id' => 5, 'libelle' => 'donation in money', 'extension' => self::DONATION_TYPE),
array('id' => 6, 'libelle' => 'partnership', 'extension' => self::DONATION_TYPE),
array('id' => 7, 'libelle' => 'annual fee (to be paid)', 'extension' => self::DEFAULT_TYPE)
)

The documentation for this class was generated from the following file: