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.phpTable:
videosPrimary Key:
id_videos
Associations
belongsTo
Behaviors
beforeSave()
Automatically generates unique URL slugs from video titles. Process:- Creates slug from
titulo_videousingInflector::slug() - Checks for existing URLs
- Appends numeric suffix if duplicate found
- Converts underscores to hyphens
- Input: “My Great Video”
- Output: “my-great-video”
- If exists: “my-great-video-1”
Venta
Represents sales transactions. Location:app/models/venta.phpTable:
ventasPrimary Key:
id_venta
Associations
belongsTo
Fields
fecha- Sale datecantidad- Quantity purchasedcuantos- Total itemsforma_pago- Payment methodnumero_pago- Payment reference numberstatus- Sale status (0=pending, 1=completed, 2=failed, 3=finalized)
User
Represents system users (administrators, vendors). Location:app/models/user.phpTable:
usersPrimary 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.phpTable:
registersPrimary Key:
idregistroDisplay Field:
foto
Validation Rules
Fields
nombreape- Full namecorreo- Email address (unique)password- Hashed passwordtelefono- Phone number with country codesexo- Genderfechanac- Birth datepuntuacion_positiva- Positive reputation scorepuntuacion_negativa- Negative reputation scorefbookid- Facebook ID (for social login)status- Account status (0=inactive, 1=active)
Promo
Represents promotional offers. Location:app/models/promo.phpTable:
promosPrimary Key:
id_promoDisplay Field:
thumbnails
Associations
belongsTo
hasMany
hasAndBelongsToMany
Validation Rules
Behaviors
MeioUpload
beforeSave()
Generates unique URL slugs from promotion text and keywords. Process:- Creates slug from
texto_promo+claves - Checks for duplicates
- Appends numeric suffix if needed
- Converts underscores to hyphens
Page
Represents customer inquiries and messages. Location:app/models/page.phpTable:
pagesPrimary Key:
id_page
Associations
belongsTo
Validation Rules
Fields
fecha- Message datestatus- Message status (0=unanswered, 1=answered)resp- Responder user ID (0 if unanswered)
Locale
Represents stores/businesses. Location:app/models/locale.phpTable:
localesPrimary Key:
id_localDisplay Field:
nombre_file
Associations
belongsTo
hasAndBelongsToMany
Validation Rules
Behaviors
MeioUpload
Fields
nombre_empresa- Business namerif- Tax ID (unique)encargado_nombre- Manager first nameencargado_apellido- Manager last nameencargado_cedula- Manager ID numbertelefono_cel- Mobile phonecorreo- Email addressdireccion- Physical addresscodigo- Store code (generated)n_cuenta_uno- Bank account numberdescripcion_n_cuenta_uno- Bank account descriptionn_cuenta_dos- Second bank account (optional)descripcion_n_cuenta_dos- Second bank account descriptionstatus- Store status (0=inactive, 1=active)
Group
Represents user permission groups. Location:app/models/group.phpTable:
groupsPrimary 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
Gallery
Represents product galleries/items. Location:app/models/gallery.phpTable:
galleriesPrimary Key:
id_galeriaDisplay Field:
thumbnails
Associations
belongsTo
hasMany
hasAndBelongsToMany
Validation Rules
Behaviors
MeioUpload
beforeSave()
Generates unique URL slugs from product title and keywords. Process:- Creates slug from
texto_galeria+claves - Checks for existing URLs
- Appends numeric suffix if duplicate
- Converts underscores to hyphens
Fields
texto_galeria- Product titleclaves- Keywords/tagsdescripcion- Product descriptionurl- URL slug (auto-generated)precio- Pricecantidad- Total quantitycantidad_existente- Available quantityprod_vendidos- Number soldpublicar- Published status (0=draft, 1=published)fechacre_galeria- Creation date
Denuncia
Represents customer complaints/claims. Location:app/models/denuncia.phpTable:
denunciasPrimary Key:
id_denuncia
Associations
belongsTo
Fields
nombre- Customer namesexo- Customer genderfecha- Complaint datecomentario- Complaint textstatus- Status (0=pending, 1=resolved)resp- Responder user ID (0 if unanswered)
Archivo
Represents file attachments and uploads. Location:app/models/archivo.phpTable:
archivosPrimary Key:
id_fileDisplay Field:
nombre_file
Associations
belongsTo
hasAndBelongsToMany
Behaviors
MeioUpload
Fields
nombre_file- File namevidthumbnail- Video thumbnail imageembedthumb- Embed thumbnailtipodispositivo_file- Device type
Category
Represents product and content categories. Location:app/models/category.phpTable:
categoriesPrimary Key:
id_categoriasDisplay Field:
nombre_categorias
Associations
belongsTo
hasMany
hasAndBelongsToMany
Validation Rules
Fields
nombre_categorias- Category namecategorias_id_categorias- Parent category ID (for hierarchy)