class CategoryHandler

Class CategoryHandler

Traits

Properties

protected CategoryRepository $cates CategoryRepository instance
protected CategoryItemRepository $items CategoryItemRepository instance

Methods

bool
linkHierarchy(Node $item, Node $parent)

Linked parent and child relation

int
unlinkHierarchy(Node $item, Node $parent)

unlinked parent and child relation

void
setOrder(Node $item, int|null $position = null)

Set item ordering value

__construct(CategoryRepository $cates, CategoryItemRepository $items)

CategoryHandler constructor.

create(array $attributes)

Create category

createCate(array $attributes)

Create category

put(Category $category, array $data = array())

Update category

updateCate(Category $category, array $data = array())

Update category

bool
remove(Category $category)

Remove category

bool
deleteCate(Category $category)

Delete category

createItem(Category $category, array $attributes)

Create a new category item, alias for itemCreate

void
setHierarchy(CategoryItem $item)

Set hierarchy information for new item

putItem(CategoryItem $item, array $data = array())

Modify item information

updateItem(CategoryItem $item, array $data = array())

Modify item information

bool
removeItem(CategoryItem $item, bool $force = true)

Remove single item or all descendant

bool
deleteItem(CategoryItem $item, bool $force = true)

Delete single item or all descendant

moveTo(CategoryItem $item, CategoryItem $parent = null)

Move to another parent CategoryItem

cates()

Get CategoryRepository instance

items()

Get CategoryItemRepository instance

Details

in NodePositionTrait at line 36
protected bool linkHierarchy(Node $item, Node $parent)

Linked parent and child relation

Parameters

Node $item child item instance
Node $parent parent item instance

Return Value

bool

in NodePositionTrait at line 69
protected int unlinkHierarchy(Node $item, Node $parent)

unlinked parent and child relation

Parameters

Node $item child item instance
Node $parent parent item instance

Return Value

int affected row count

in NodePositionTrait at line 95
void setOrder(Node $item, int|null $position = null)

Set item ordering value

Parameters

Node $item item object
int|null $position sequence value

Return Value

void

at line 60
__construct(CategoryRepository $cates, CategoryItemRepository $items)

CategoryHandler constructor.

Parameters

CategoryRepository $cates CategoryRepository instance
CategoryItemRepository $items CategoryItemRepository instance

at line 74
Category create(array $attributes)

Create category

Parameters

array $attributes attributes

Return Value

Category

at line 85
Category createCate(array $attributes)

Create category

Parameters

array $attributes attributes

Return Value

Category

at line 99
Category put(Category $category, array $data = array())

Update category

Parameters

Category $category category instance
array $data attributes

Return Value

Category

at line 111
Category updateCate(Category $category, array $data = array())

Update category

Parameters

Category $category category instance
array $data attributes

Return Value

Category

at line 124
bool remove(Category $category)

Remove category

Parameters

Category $category category instance

Return Value

bool

at line 135
bool deleteCate(Category $category)

Delete category

Parameters

Category $category category instance

Return Value

bool

at line 151
CategoryItem createItem(Category $category, array $attributes)

Create a new category item, alias for itemCreate

Parameters

Category $category category instance
array $attributes item attributes for created

Return Value

CategoryItem

at line 169
protected void setHierarchy(CategoryItem $item)

Set hierarchy information for new item

Parameters

CategoryItem $item item object

Return Value

void

at line 188
CategoryItem putItem(CategoryItem $item, array $data = array())

Modify item information

Parameters

CategoryItem $item item object
array $data attribute data

Return Value

CategoryItem

at line 200
CategoryItem updateItem(CategoryItem $item, array $data = array())

Modify item information

Parameters

CategoryItem $item item object
array $data attribute data

Return Value

CategoryItem

at line 218
bool removeItem(CategoryItem $item, bool $force = true)

Remove single item or all descendant

Parameters

CategoryItem $item item object
bool $force if true then remove all descendant

Return Value

bool

at line 230
bool deleteItem(CategoryItem $item, bool $force = true)

Delete single item or all descendant

Parameters

CategoryItem $item item object
bool $force if true then remove all descendant

Return Value

bool

at line 252
CategoryItem moveTo(CategoryItem $item, CategoryItem $parent = null)

Move to another parent CategoryItem

Parameters

CategoryItem $item item object
CategoryItem $parent new parent item object

Return Value

CategoryItem

Exceptions

UnableMoveToSelfException

at line 286
CategoryRepository cates()

Get CategoryRepository instance

Return Value

CategoryRepository

at line 296
CategoryItemRepository items()

Get CategoryItemRepository instance

Return Value

CategoryItemRepository