Skip to content

Commit 25e59cc

Browse files
authored
Merge pull request #19 from Linfuby/master
Update README.md
2 parents 8ba273c + e100aa8 commit 25e59cc

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ $articles = $articles->asArray();
204204
// Convert it into plain objects,
205205
// useful for serializing
206206
$data = $articles->asArray(true);
207+
208+
// Convert it into associative array
209+
$data = $articles->asArray(true, 'id');
207210
```
208211

209212
If you are going to access a particular relationship for multiple items that you are selecting
@@ -483,7 +486,7 @@ return array(
483486
// e.g. $category->articles();
484487
//
485488
// defaults to the plural of the item model
486-
'property' => 'articles'
489+
'itemsProperty' => 'articles'
487490
),
488491

489492
'itemsOptions' => array(
@@ -492,7 +495,7 @@ return array(
492495
// e.g. $article->category()
493496
//
494497
// defaults to the owner model
495-
'property' => 'category',
498+
'ownerProperty' => 'category',
496499

497500
// the field that is used to link items
498501
// defaults to '<property>Id'
@@ -620,7 +623,7 @@ return array(
620623
// mandatory options
621624
'type' => 'oneToOne',
622625
'owner' => 'worker',
623-
'items' => 'task',
626+
'item' => 'task',
624627

625628
// The following keys are optional
626629
// and will fallback to the defaults
@@ -632,7 +635,7 @@ return array(
632635
//
633636
// Unlike manyToMany this uses
634637
// a singular case by default
635-
'property' => 'task'
638+
'itemProperty' => 'task'
636639
),
637640

638641
// note it's 'itemOptions' here
@@ -641,7 +644,7 @@ return array(
641644

642645
// the name of the property added to items
643646
// e.g. $task->worker()
644-
'property' => 'worker',
647+
'ownerProperty' => 'worker',
645648

646649
// the field that is used to link items
647650
// defaults to '<property>Id'
@@ -706,11 +709,11 @@ return array(
706709
// based on model names
707710

708711
'leftOptions' => array(
709-
'property' => 'tags'
712+
'rightProperty' => 'tags'
710713
),
711714

712715
'rightOptions' => array(
713-
'property' => 'articles'
716+
'leftProperty' => 'articles'
714717
),
715718

716719
// depends on property names
@@ -1059,7 +1062,7 @@ return array(
10591062
// All of them are INTEGER
10601063
// These are their default names
10611064
'leftKey' => 'left',
1062-
'leftKey' => 'right',
1065+
'rightKey' => 'right',
10631066
'depthKey' => 'depth',
10641067
'rootIdKey' => 'rootId',
10651068

0 commit comments

Comments
 (0)