v5:activerecord:classhasmany
This is an old revision of the document!
classHasMany
Syntax
void ADODB_Active_Record::ClassHasMany( string $class, string $relation, optional string $foreignKey = ' ', optional string $foreignClass = 'ADODB_Active_Record' )
Description
Globally defines a one-to-many relationship. Once defined, the relationship is maintained for the life of the script.
Usage
class person extends ADOdb_Active_Record{} ADODB_Active_Record::ClassHasMany('person', 'children','person_id'); $person = new person(); $person->Load("id=1"); foreach($person->children as $c) { echo " $c->name_first "; $c->name_first .= ' K.'; $c->Save(); ## each child record must be saved individually }
v5/activerecord/classhasmany.1449327227.txt.gz · Last modified: 2017/04/21 11:21 (external edit)