\CMS_TermTaxonomy

TermTaxonomy data model.

A term is not a category or tag on its own. It must be given context via the TermTaxonomy entity. The TermTaxonomy places a term within a taxonomy. This is what makes a term a category, a tag or part of a custom taxonomy (or in a combination of taxonomies).

  • taxonomy: designates the taxonomy in which the term resides. Some of examples for taxonomy are category, tag or link.
  • term_id: is the ID of a term in the terms table
  • The rest of the fields provide information about the term in the context of the taxonomy.

  • parent_id: it keeps track of hierarchical relationships between terms in the taxonomy.
  • description: provides a taxonomy specific description of the term.
  • count: tracks how many objects are associated with the term+taxonomy pair.
  • Summary

    Methods
    Properties
    Constants
    __construct()
    init()
    _init()
    getRelationKeysToModel()
    getForeignKeysToModel()
    getData()
    setAssoc()
    delAssoc()
    batchAssoc()
    _getConnection()
    getDbConnection()
    getSqlTable()
    __get()
    __set()
    __call()
    get()
    getOne()
    getList()
    getCount()
    getRelated()
    getSelect()
    update()
    create()
    getDeleteSideEffect()
    delete()
    _reset()
    __toString()
    restore()
    preSave()
    postSave()
    preDelete()
    setFromFormData()
    setView()
    _toDb()
    _fromDb()
    displayVal()
    isAnonymous()
    getClass()
    getId()
    jsonSerialize()
    getName()
    getSchema()
    $_model
    $_con
    $_a
    $_data
    $_cache
    $_fk
    $_m
    No constants found
    _setupAutomaticListMethods()
    _setupMultitenantFields()
    $tenant_field
    N/A
    getFieldInfo()
    No private properties found
    N/A

    Properties

    $_model

    $_model : 

    Type

    $_con

    $_con : 

    Database connection.

    Type

    $_a

    $_a : 

    Store the attributes of the model.

    To minimize pollution of the property space, all the attributes are stored in this array.

    Description of the keys: 'multitenant: Determines possibility of define the model in each tenant separately 'mapped': Determines that the model is a mapped model of another model. A mapped model have not a separate table. 'table': The table in which the model is stored. 'model': The name of the model. 'cols': The definition of the columns. 'idx': The definition of the indexes. 'views': The definition of the views. 'verbose': The verbose name of the model.

    Type

    $_data

    $_data : 

    Storage of the data.

    The object data are stored in an associative array. Each key corresponds to a column and stores a Pluf_DBField* variable.

    Type

    $_cache

    $_cache : 

    Storage cached data for methods_get

    Type

    $_fk

    $_fk : 

    List of the foreign keys.

    Set by the init() method from the definition of the columns.

    Type

    $_m

    $_m : 

    Methods available, this array is dynamically populated by init method.

    Type

    $tenant_field

    $tenant_field : array

    Tenant field

    This field is added to model in the multi-tenancy mode automaticlly.

    Type

    array

    Methods

    __construct()

    __construct(  $pk = null,   $values = array()) 

    Parameters

    $pk
    $values

    init()

    init() 

    مدل داده‌ای را بارگذاری می‌کند.

    این فراخوانی تمام ساختارهای داده‌ای اصلی را ایجاد می‌کند. تمام زیر کلاس‌ها باید این کلاس را پیاده سازی کنند و ساختارهای داده‌ای خود را ایجاد کنند.

    _init()

    _init() 

    Load and init the model

    getRelationKeysToModel()

    getRelationKeysToModel(string  $model, string  $type) : array

    Retrieve key relationships of a given model.

    Parameters

    string $model
    string $type

    Relation type: 'foreignkey' or 'manytomany'.

    Returns

    array —

    Key relationships.

    getForeignKeysToModel()

    getForeignKeysToModel(  $model) : array

    Get the foreign keys relating to a given model.

    Parameters

    $model

    Returns

    array —

    Foreign keys

    getData()

    getData() : array

    Get the raw data of the object.

    For the many to many relations, the value is an array of ids.

    Returns

    array —

    Associative array of the data.

    setAssoc()

    setAssoc(  $model) 

    Set the association of a model to another in many to many.

    Parameters

    $model

    delAssoc()

    delAssoc(  $model) 

    Set the association of a model to another in many to many.

    Parameters

    $model

    batchAssoc()

    batchAssoc(  $model_name,   $ids) : boolean

    Bulk association of models to the current one.

    Parameters

    $model_name
    $ids

    Returns

    boolean —

    Success

    _getConnection()

    _getConnection() 

    Get a database connection.

    getDbConnection()

    getDbConnection() 

    Get a database connection.

    getSqlTable()

    getSqlTable() 

    Get the table of the model.

    Avoid doing the concatenation of the prefix and the table manually.

    __get()

    __get(  $prop) 

    Overloading of the get method.

    Parameters

    $prop

    __set()

    __set(  $prop,   $val) 

    Overloading of the set method.

    Parameters

    $prop
    $val

    __call()

    __call(  $method,   $args) 

    Overloading of the method call.

    Parameters

    $method
    $args

    get()

    get(  $id) : mixed

    Get a given item.

    Parameters

    $id

    Returns

    mixed —

    Item or false if not found.

    getOne()

    getOne(  $p = array()) : \Pluf_Model|null

    Get one item.

    The parameters are the same as the ones of the getList method, but, the return value is either:

    • The object
    • null if no match
    • Exception if the match results in more than one item.

    Usage:

    $m = Pluf::factory(My_Model::class)->getOne(array('filter' => 'id=1'));
    
    $m = Pluf::factory(My_Model::class)->getOne('id=1');
    

    Parameters

    $p

    Returns

    \Pluf_Model|null —

    find model

    getList()

    getList(  $p = array()) : \ArrayObject

    یک فهرست از موجودیت‌ها را تعیین می‌کند

    The filter should be used only for simple filtering. If you want a complex query, you should create a new view. Both filter and order accept an array or a string in case of multiple parameters: Filter: array('col1=toto', 'col2=titi') will be used in a AND query or simply 'col1=toto' Order: array('col1 ASC', 'col2 DESC') or 'col1 ASC'

    This is modelled on the DB_Table pear module interface.

    Parameters

    $p

    Returns

    \ArrayObject —

    of items or through an exception if database failure

    getCount()

    getCount(  $p = array()) : integer

    Get the number of items.

    Parameters

    $p

    Returns

    integer —

    The number of items

    getRelated()

    getRelated(  $model,   $method = null,   $p = array()) : array

    Get a list of related items.

    See the getList() method for usage of the view and filters.

    Parameters

    $model
    $method
    $p

    Returns

    array —

    Array of items

    getSelect()

    getSelect() 

    Generate the SQL select from the columns

    update()

    update(  $where = '') : boolean

    Update the model into the database.

    If no where clause is provided, the index definition is used to find the sequence. These are used to limit the update to the current model.

    Parameters

    $where

    Returns

    boolean —

    Success

    create()

    create(  $raw = false) : boolean

    Create the model into the database.

    If raw insert is requested, the preSave/postSave methods are not called and the current id of the object is directly used. This is particularily used when doing backup/restore of data.

    Parameters

    $raw

    Returns

    boolean —

    Success

    getDeleteSideEffect()

    getDeleteSideEffect() : array

    Get models affected by delete.

    Returns

    array —

    Models deleted if deleting current model.

    delete()

    delete() 

    Delete the current model from the database.

    If another model link to the current model through a foreign key, the DB is responsible to mange relations.

    _reset()

    _reset() 

    Reset the fields to default values.

    __toString()

    __toString() : string

    Represents the model in auto generated lists.

    You need to overwrite this method to have a nice display of your objects in the select boxes, logs.

    Returns

    string —

    reperesentation of the current object

    restore()

    restore() 

    Hook run just after loading a model from the database.

    Just overwrite it into your model to perform custom actions.

    preSave()

    preSave(  $create = false) 

    دستگیره‌ای که درست قبل از ذخیره شدن در پایگاه داده اجرا می‌شود.

    در صورتی که نیاز به انجام پردازش‌هایی قبل از ذخیره شدن مدل داده‌ای دارید، این فراخوانی را بازنویسی کنید.

    Parameters

    $create

    postSave()

    postSave(string  $create = false) 

    فراخوانی پس از ذخیره شدن

    Parameters

    string $create

    preDelete()

    preDelete() 

    Hook run just before deleting a model from the database.

    Just overwrite it into your model to perform custom actions.

    setFromFormData()

    setFromFormData(  $cleaned_values) 

    مقادیر مدل را بر اساس یک فرم تعیین می‌کند

    این مقادیر به صورت یک آرایه به عنوان ورودی دریافت شده و بر اساس آن داده‌های مورد نیاز مدل تعیین می‌شود.

    Parameters

    $cleaned_values

    setView()

    setView(  $view,   $def) 

    Set a view.

    Parameters

    $view
    $def

    _toDb()

    _toDb(  $val,   $col) : string

    Prepare the value to be put in the DB.

    Parameters

    $val
    $col

    Returns

    string —

    SQL ready string.

    _fromDb()

    _fromDb(  $val,   $col) : mixed

    Get the value from the DB.

    Create DB field and returns. The field type is used as the output value type.

    Parameters

    $val
    $col

    Returns

    mixed —

    Value.

    displayVal()

    displayVal(  $col) : mixed

    Display value.

    When you have a list of choices for a field and you want to get the display value of the current stored value.

    Parameters

    $col

    Returns

    mixed —

    Display value, if not available default to the value.

    isAnonymous()

    isAnonymous() : boolean

    بررسی می‌کند که آیا مدل داده‌ای وجود دارد یا نه

    در صورتی که مدل داده‌ای ذخیره نشده باشد به عنوان داده بی نام و نشان در نظر گرفته می‌شود. در مورد کاربران این تابع کاربرد فراوان دارد.

    Returns

    boolean —

    True if the user is anonymous.

    getClass()

    getClass() : string

    مدل داده‌ای را تعیین می‌کند

    هر مدل داده‌ای یک نام دارد.

    این فراخوانی نام مدل داده‌ای را تعیین می‌کند که معادل با نام کلاس است.

    Returns

    string

    getId()

    getId() : integer

    شناسه را تعیین می‌کند.

    Returns

    integer —

    id

    jsonSerialize()

    jsonSerialize() 

    (non-PHPdoc)

    getName()

    getName() 

    getSchema()

    getSchema() 

    _setupAutomaticListMethods()

    _setupAutomaticListMethods(string  $type) 

    متدهای اتوماتیک را برای مدل ورودی ایجاد می‌کند.

    Adds the get_xx_list method when the methods of the model contains custom names.

    Parameters

    string $type

    Relation type: 'foreignkey' or 'manytomany'.

    _setupMultitenantFields()

    _setupMultitenantFields() 

    Add tenant required fields

    Adds extra fields if multi-tenant is enabled

    getFieldInfo()

    getFieldInfo(  $name,   $field) 

    Parameters

    $name
    $field