ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:activerecord:tablekeyhasmany

This is an old revision of the document!


tableKeyHasMany

Syntax
void ADODB_Active_Record::tableKeyHasMany(
  string $table, 
  string $tablePrimaryKey, 
  string $relation,
  optional string $foreignKey = ' ', 
  optional string $foreignClass = 'ADODB_Active_Record'
 )

Description

For some classes, the mapping between class name and table name (which is the pluralised version) might not match or the primary key is not the default id. For example, the class name might be person, but the table name might be people

Usage

ADODB_Active_Record::TableKeyHasMany('people', 'pid', 'children', 'person_id');
v5/activerecord/tablekeyhasmany.1449323456.txt.gz · Last modified: 2017/04/21 11:20 (external edit)