Skip to main content

Models API Reference

This document provides comprehensive documentation for all models in the Yoneily system, including their database tables, associations, validation rules, and behaviors.

Video

Represents video content in the system. Location: app/models/video.php
Table: videos
Primary Key: id_videos

Associations

belongsTo

Behaviors

beforeSave()

Automatically generates unique URL slugs from video titles. Process:
  1. Creates slug from titulo_video using Inflector::slug()
  2. Checks for existing URLs
  3. Appends numeric suffix if duplicate found
  4. Converts underscores to hyphens
Example:
  • Input: “My Great Video”
  • Output: “my-great-video”
  • If exists: “my-great-video-1”

Venta

Represents sales transactions. Location: app/models/venta.php
Table: ventas
Primary Key: id_venta

Associations

belongsTo

Fields

  • fecha - Sale date
  • cantidad - Quantity purchased
  • cuantos - Total items
  • forma_pago - Payment method
  • numero_pago - Payment reference number
  • status - Sale status (0=pending, 1=completed, 2=failed, 3=finalized)

User

Represents system users (administrators, vendors). Location: app/models/user.php
Table: users
Primary Key: id_usuario

Associations

belongsTo

Validation Rules

Behaviors

ACL (Access Control List)

Implements CakePHP ACL requester behavior.

parentNode()

Returns the user’s group as the parent node for ACL tree structure. Returns: array('Group' => array('idgrupos' => $groupId))

Register

Represents customer registrations. Location: app/models/register.php
Table: registers
Primary Key: idregistro
Display Field: foto

Validation Rules

Fields

  • nombreape - Full name
  • correo - Email address (unique)
  • password - Hashed password
  • telefono - Phone number with country code
  • sexo - Gender
  • fechanac - Birth date
  • puntuacion_positiva - Positive reputation score
  • puntuacion_negativa - Negative reputation score
  • fbookid - Facebook ID (for social login)
  • status - Account status (0=inactive, 1=active)

Promo

Represents promotional offers. Location: app/models/promo.php
Table: promos
Primary Key: id_promo
Display Field: thumbnails

Associations

belongsTo

hasMany

hasAndBelongsToMany

Validation Rules

Behaviors

MeioUpload

beforeSave()

Generates unique URL slugs from promotion text and keywords. Process:
  1. Creates slug from texto_promo + claves
  2. Checks for duplicates
  3. Appends numeric suffix if needed
  4. Converts underscores to hyphens

Page

Represents customer inquiries and messages. Location: app/models/page.php
Table: pages
Primary Key: id_page

Associations

belongsTo

Validation Rules

Fields

  • fecha - Message date
  • status - Message status (0=unanswered, 1=answered)
  • resp - Responder user ID (0 if unanswered)

Locale

Represents stores/businesses. Location: app/models/locale.php
Table: locales
Primary Key: id_local
Display Field: nombre_file

Associations

belongsTo

hasAndBelongsToMany

Validation Rules

Behaviors

MeioUpload

Fields

  • nombre_empresa - Business name
  • rif - Tax ID (unique)
  • encargado_nombre - Manager first name
  • encargado_apellido - Manager last name
  • encargado_cedula - Manager ID number
  • telefono_cel - Mobile phone
  • correo - Email address
  • direccion - Physical address
  • codigo - Store code (generated)
  • n_cuenta_uno - Bank account number
  • descripcion_n_cuenta_uno - Bank account description
  • n_cuenta_dos - Second bank account (optional)
  • descripcion_n_cuenta_dos - Second bank account description
  • status - Store status (0=inactive, 1=active)

Group

Represents user permission groups. Location: app/models/group.php
Table: groups
Primary Key: idgrupos

Behaviors

ACL (Access Control List)

Implements CakePHP ACL requester behavior.

parentNode()

Returns null as groups are root nodes in ACL tree. Returns: null

Fields

  • name_grupos - Group name

Represents product galleries/items. Location: app/models/gallery.php
Table: galleries
Primary Key: id_galeria
Display Field: thumbnails

Associations

belongsTo

hasMany

hasAndBelongsToMany

Validation Rules

Behaviors

MeioUpload

beforeSave()

Generates unique URL slugs from product title and keywords. Process:
  1. Creates slug from texto_galeria + claves
  2. Checks for existing URLs
  3. Appends numeric suffix if duplicate
  4. Converts underscores to hyphens

Fields

  • texto_galeria - Product title
  • claves - Keywords/tags
  • descripcion - Product description
  • url - URL slug (auto-generated)
  • precio - Price
  • cantidad - Total quantity
  • cantidad_existente - Available quantity
  • prod_vendidos - Number sold
  • publicar - Published status (0=draft, 1=published)
  • fechacre_galeria - Creation date

Denuncia

Represents customer complaints/claims. Location: app/models/denuncia.php
Table: denuncias
Primary Key: id_denuncia

Associations

belongsTo

Fields

  • nombre - Customer name
  • sexo - Customer gender
  • fecha - Complaint date
  • comentario - Complaint text
  • status - Status (0=pending, 1=resolved)
  • resp - Responder user ID (0 if unanswered)

Archivo

Represents file attachments and uploads. Location: app/models/archivo.php
Table: archivos
Primary Key: id_file
Display Field: nombre_file

Associations

belongsTo

hasAndBelongsToMany

Behaviors

MeioUpload

Fields

  • nombre_file - File name
  • vidthumbnail - Video thumbnail image
  • embedthumb - Embed thumbnail
  • tipodispositivo_file - Device type

Category

Represents product and content categories. Location: app/models/category.php
Table: categories
Primary Key: id_categorias
Display Field: nombre_categorias

Associations

belongsTo

hasMany

hasAndBelongsToMany

Validation Rules

Fields

  • nombre_categorias - Category name
  • categorias_id_categorias - Parent category ID (for hierarchy)

Build docs developers (and LLMs) love