Models BaseList


BaseList provides powerful methods to allow your custom classes to use a database table as List. To start using the benefits, your class must extends the BaseList:

class <Your_Class> extends \Boostack\Models\BaseList {

To use \Boostack\Models\BaseList you need to first declare the BaseClass table into a Constant


Than initialize the constructor method of the \Boostack\Models\BaseList class

public function __construct(){


  • view($fields,$orderColumn,$orderType,$numitem,$currentPage).
    The view method can be used to obtain data from the table filtered and paginated
    view($fields, $orderColumn, $orderType, $numitem, $currentPage);

    The view method accept only this type of parameter:
    • $fields is a Array composed by three option: columnName, operator and the word to search.
    • $orderColumn contain the name of column to order by.
    • $orderType can be "ASC" or "DESC" to get data Ascended or Descended.
    • $numitem container the Limit element of how much item to view.
    • $currentPage contain the current page number according to the number of item to view.
  • loadAll()
    Load from the database table all the item and return the number of item as result.
  • truncate()
    Used for truncate the database.
  • getIterator()
    If you are used loadAll method you can use getIterator method to iterate the list like an array.
  • getItemsArray()
    Return the database table item as array.
  • size()
    Return the number of items.
  • isEmpty()
    Return boolean if the table is empty.
  • jsonSerialize()
    This method is used when json_encode() is called, it expose "items" to the json_encode() function.
  • add($element)
    This method is used to add item into array.
  • get($key)
    This method is used to get item by key.
  • remove($key,$shift)
    This method is used to remove item from array.
  • clear()
    This method is used to clear the item array.
  • fill
    This method is used to Fill the list with an array of array of object fields


Jump to BaseList Example →