CouponRepository extends AbstractPostRepository
in package

Table of Contents

TYPE_PER_ACCOMM  = 'per_accomm'
TYPE_PER_ACCOMM_PER_DAY  = 'per_accomm_per_day'
TYPE_PERCENT  = ''
$items  : mixed
$persistence  : CPTPersistence
$type  : mixed
__construct()  : mixed
delete()  : int
findAll()  : mixed
findByCode()  : AbstractCoupon|null
findById()  : AbstractCoupon
findByMeta()  : mixed
findOne()  : mixed
mapEntityToPostData()  : WPPostData
mapPostToEntity()  : AbstractCoupon
persistence()  : CPTPersistence
save()  : int
mapPostsToEntity()  : mixed
detectType()  : string
initTypedCoupon()  : AbstractCoupon

Constants

TYPE_PER_ACCOMM

public mixed TYPE_PER_ACCOMM = 'per_accomm'

TYPE_PER_ACCOMM_PER_DAY

public mixed TYPE_PER_ACCOMM_PER_DAY = 'per_accomm_per_day'

TYPE_PERCENT

public mixed TYPE_PERCENT = ''

Properties

$items

protected mixed $items = array()

$persistence

protected CPTPersistence $persistence

$type

protected mixed $type = 'abstract'

Methods

__construct()

public __construct(CPTPersistence $persistence) : mixed
Parameters
$persistence : CPTPersistence
Return values
mixed

delete()

public delete(type $entity) : int
Parameters
$entity : type
Return values
int

Id of deleted entity. 0 on failure.

findAll()

public findAll([mixed $atts = array() ]) : mixed
Parameters
$atts : mixed = array()
Return values
mixed

findByCode()

public findByCode(string $code) : AbstractCoupon|null
Parameters
$code : string
Return values
AbstractCoupon|null

findById()

public findById(int $id[, bool $force = false ]) : AbstractCoupon
Parameters
$id : int
$force : bool = false
Return values
AbstractCoupon

findByMeta()

public findByMeta(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed

TODO Bug: will find the latest entity with the right meta_key and null meta_value; with a wrong meta_key will return null.

findOne()

public findOne([mixed $atts = array() ]) : mixed
Parameters
$atts : mixed = array()
Return values
mixed

mapPostToEntity()

public mapPostToEntity(WP_Post|int $post) : AbstractCoupon
Parameters
$post : WP_Post|int
Return values
AbstractCoupon

persistence()

public persistence() : CPTPersistence
Tags
since
3.7.2
Return values
CPTPersistence

save()

public save(type &$entity) : int
Parameters
$entity : type
Return values
int

mapPostsToEntity()

protected mapPostsToEntity(mixed $posts) : mixed
Parameters
$posts : mixed
Return values
mixed

detectType()

private detectType(AbstractCoupon $entity) : string
Parameters
$entity : AbstractCoupon
Return values
string

initTypedCoupon()

private initTypedCoupon(array<string|int, mixed> $atts, string $type) : AbstractCoupon
Parameters
$atts : array<string|int, mixed>
$type : string
Return values
AbstractCoupon

Search results