Skip to content

Latest commit

 

History

History
1207 lines (619 loc) · 27 KB

class.MessageCore.md

File metadata and controls

1207 lines (619 loc) · 27 KB

Class MessageCore

Contents

Properties

Methods

Properties

$date_add

public string $date_add

$fieldsRequired

protected mixed $fieldsRequired = array('message')

$fieldsSize

protected mixed $fieldsSize = array('message' => 1600)

$fieldsValidate

protected mixed $fieldsValidate = array('message' => 'isCleanHtml', 'id_cart' => 'isUnsignedId', 'id_order' => 'isUnsignedId', 'id_customer' => 'isUnsignedId', 'id_employee' => 'isUnsignedId', 'private' => 'isBool')

$id

public mixed $id

$id_cart

public integer $id_cart

$id_customer

public integer $id_customer

$id_employee

public integer $id_employee

$id_order

public integer $id_order

$identifier

protected mixed $identifier = 'id_message'

$message

public string $message

$private

public boolean $private

$table

protected mixed $table = 'message'

$_cache

protected mixed $_cache = array()

$fieldsRequiredDatabase

protected \fieldsRequiredDatabase $fieldsRequiredDatabase = null

$fieldsRequiredLang

protected array $fieldsRequiredLang = array()

$fieldsSizeLang

protected array $fieldsSizeLang = array()

$fieldsValidateLang

protected array $fieldsValidateLang = array()

$id_lang

protected integer $id_lang = null

$id_shop

protected mixed $id_shop = null

$image_dir

protected string $image_dir = null

$image_format

protected string $image_format = 'jpg'

$langMultiShop

protected mixed $langMultiShop = false

$tables

protected array $tables = array()

$webserviceParameters

protected array $webserviceParameters = array()

Methods

__construct

mixed ObjectModelCore::__construct(integer $id, integer $id_lang, $id_shop)

Build object

Arguments

  • $id integer - Existing object id in order to load object (optional)
  • $id_lang integer - Required if object is multilingual (optional)
  • $id_shop mixed

add

mixed ObjectModelCore::add($autodate, $nullValues)

Add current object to database

return boolean Insertion result

Arguments

  • $autodate mixed
  • $nullValues mixed

addFieldsRequiredDatabase

mixed ObjectModelCore::addFieldsRequiredDatabase($fields)

Arguments

  • $fields mixed

associateTo

boolean ObjectModelCore::associateTo(integer|array $id_shops, string $type)

This function associate an item to its context

Arguments

  • $id_shops integer|array
  • $type string

clearCache

mixed ObjectModelCore::clearCache($all)

Arguments

  • $all mixed

delete

mixed ObjectModelCore::delete()

Delete current object from database

return boolean Deletion result

deleteImage

boolean ObjectModelCore::deleteImage()

Delete images associated with the object

deleteSelection

mixed ObjectModelCore::deleteSelection($selection)

Delete several objects from database

return boolean Deletion result

Arguments

  • $selection mixed

displayFieldName

mixed ObjectModelCore::displayFieldName($field, $className, $htmlentities, \Context $context)

Arguments

  • $field mixed
  • $className mixed
  • $htmlentities mixed
  • $context Context

duplicateShops

mixed ObjectModelCore::duplicateShops($id)

Arguments

  • $id mixed

existsInDatabase

boolean ObjectModelCore::existsInDatabase($id_entity, $table)

Specify if an ObjectModel is already in database

Arguments

  • $id_entity mixed - entity id
  • $table mixed

getFields

mixed MessageCore::getFields()

getFieldsRequiredDatabase

mixed ObjectModelCore::getFieldsRequiredDatabase($all)

Arguments

  • $all mixed

getFieldsValidateLang

array ObjectModelCore::getFieldsValidateLang()

Get list of fields related to language to validate

getIdentifier

string ObjectModelCore::getIdentifier()

Get object identifier name

getMessageByCartId

array MessageCore::getMessageByCartId(integer $id_cart)

Return the last message from cart

Arguments

  • $id_cart integer - Cart ID

getMessagesByCartId

array MessageCore::getMessagesByCartId($id_cart, boolean $private, \Context $context)

Return messages from Cart ID

Arguments

  • $id_cart mixed
  • $private boolean - return WITH private messages
  • $context Context

getMessagesByOrderId

array MessageCore::getMessagesByOrderId(integer $id_order, boolean $private, \Context $context)

Return messages from Order ID

Arguments

  • $id_order integer - Order ID
  • $private boolean - return WITH private messages
  • $context Context

getTranslationsFields

mixed ObjectModelCore::getTranslationsFields(array $fieldsArray)

Prepare multilingual fields for database insertion

Arguments

  • $fieldsArray array - Multilingual fields to prepare return array Prepared fields for database insertion

getValidationRules

array ObjectModelCore::getValidationRules(string $className)

Returns object validation rules (fields validity)

Arguments

  • $className string - Child class name for static use (optional)

getWebserviceObjectList

mixed ObjectModelCore::getWebserviceObjectList($sql_join, $sql_filter, $sql_sort, $sql_limit)

Arguments

  • $sql_join mixed
  • $sql_filter mixed
  • $sql_sort mixed
  • $sql_limit mixed

getWebserviceParameters

mixed ObjectModelCore::getWebserviceParameters($wsParamsAttributeName)

Arguments

  • $wsParamsAttributeName mixed

hydrate

mixed ObjectModelCore::hydrate(array $data, integer $id_lang)

Fill an object with given data. Data must be an array with this syntax: array(objProperty => value, objProperty2 => value, etc.)

Arguments

  • $data array
  • $id_lang integer

hydrateCollection

array ObjectModelCore::hydrateCollection(string $class, array $datas, integer $id_lang)

Fill (hydrate) a list of objects in order to get a collection of these objects

Arguments

  • $class string - Class of objects to hydrate
  • $datas array - List of data (multi-dimensional array)
  • $id_lang integer

isAssociatedToGroupShop

boolean ObjectModelCore::isAssociatedToGroupShop(integer $id_group_shop)

Check if current object is associated to a group shop

Arguments

  • $id_group_shop integer

isAssociatedToShop

boolean ObjectModelCore::isAssociatedToShop(integer $id_shop)

Check if current object is associated to a shop

Arguments

  • $id_shop integer

isCurrentlyUsed

boolean ObjectModelCore::isCurrentlyUsed(string $table, boolean $has_active_column)

This method is allow to know if a entity is currently used

Arguments

  • $table string - name of table linked to entity
  • $has_active_column boolean - true if the table has an active column

isLangMultishop

mixed ObjectModelCore::isLangMultishop()

makeTranslationFields

mixed ObjectModelCore::makeTranslationFields($fields, $fieldsArray, $id_language)

Arguments

  • $fields mixed
  • $fieldsArray mixed
  • $id_language mixed

markAsReaded

mixed MessageCore::markAsReaded(integer $id_message, $id_employee)

Registered a message 'readed'

Arguments

  • $id_message integer - Message ID
  • $id_employee mixed

save

mixed ObjectModelCore::save($nullValues, $autodate)

Save current object to database (add or update)

return boolean Insertion result

Arguments

  • $nullValues mixed
  • $autodate mixed

toggleStatus

mixed ObjectModelCore::toggleStatus()

Toggle object status in database

return boolean Update result

update

boolean ObjectModelCore::update($nullValues)

Update current object to database

Arguments

  • $nullValues mixed

validateControler

mixed ObjectModelCore::validateControler($htmlentities)

TODO: refactor rename all calls to this to validateController

Arguments

  • $htmlentities mixed

validateController

mixed ObjectModelCore::validateController($htmlentities)

Arguments

  • $htmlentities mixed

validateFields

mixed ObjectModelCore::validateFields($die, $errorReturn)

Check for fields validity before database interaction

Arguments

  • $die mixed
  • $errorReturn mixed

validateFieldsLang

mixed ObjectModelCore::validateFieldsLang($die, $errorReturn)

Check for multilingual fields validity before database interaction

Arguments

  • $die mixed
  • $errorReturn mixed