v5:activerecord:belongsto
Differences
This shows you the differences between two versions of the page.
Last revisionBoth sides next revision | |||
activerecord:belongsto [2015/12/05 15:34] – created mnewnham | activerecord:belongsto [2015/12/05 15:41] – mnewnham | ||
---|---|---|---|
Line 6: | Line 6: | ||
<WRAP right box> | <WRAP right box> | ||
==Syntax== | ==Syntax== | ||
- | void ADODB_Active_Record:: | + | void belongsTo( |
string $relationName, | string $relationName, | ||
string $foreignKey, | string $foreignKey, | ||
Line 19: | Line 19: | ||
class Child extends ADOdb_Active_Record{}; | class Child extends ADOdb_Active_Record{}; | ||
$ch = new Child(' | $ch = new Child(' | ||
- | $ch-> | + | /* |
- | ## | + | * this can be simplified to $ch-> |
- | ## | + | * as foreign key defaults to $table.' |
+ | * parent pkey defaults to ' | ||
+ | */ | ||
+ | $ch-> | ||
$ch-> | $ch-> | ||
$p = $ch-> | $p = $ch-> | ||
- | if (!$p || $p-> | + | if (!$p || $p-> |
- | else echo "OK loading BelongTo< | + | |
+ | else | ||
+ | | ||
</ | </ |
v5/activerecord/belongsto.txt · Last modified: 2016/01/13 02:15 by mnewnham