Skip to content

Commit da58ffb

Browse files
committed
Docs example of using a relation helper.
1 parent 49d85cd commit da58ffb

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,19 @@ fail to make the OpenERP/Odoo version number clear.
127127

128128
# Setting Relationships
129129

130-
TODO (it's fairly simple once explained)
130+
There are helpers to create the relationships data.
131+
Just a simple example, replacing all invoices belonging to a
132+
partner witn a new set of invoices:
131133

132-
# TODO
134+
```php
135+
$invoiceIds = ... // array or collection of resource IDs for the invoices to link
133136

134-
* Examples on how relationships are managed are needed, since they are
135-
one of the areas that cause the most confusion. It's actuall pretty
136-
easy once you see the technique, though a helper may be useful to
137-
put together the data structure needed.
137+
$response = $client->write(
138+
'res.partner',
139+
$partnerResourceId,
140+
[
141+
'invoice_ids' => $client->relationReplaceAllLinks($invoiceIds),
142+
// other optional fields and relations can be set here too
143+
]
144+
);
145+
```

0 commit comments

Comments
 (0)