Skip to content

Commit f6e09ce

Browse files
authored
Merge pull request #7776 from cakephp/5.x-cleanup
Consistent aliasing for assocs.
2 parents d791f5c + d208841 commit f6e09ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

en/orm/associations.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,26 +186,26 @@ If you want to break different addresses into multiple associations, you can do
186186
{
187187
public function initialize(array $config): void
188188
{
189-
$this->hasOne('HomeAddress', [
189+
$this->hasOne('HomeAddresses', [
190190
'className' => 'Addresses'
191191
])
192192
->setProperty('home_address')
193-
->setConditions(['HomeAddress.label' => 'Home'])
193+
->setConditions(['HomeAddresses.label' => 'Home'])
194194
->setDependent(true);
195195

196-
$this->hasOne('WorkAddress', [
196+
$this->hasOne('WorkAddresses', [
197197
'className' => 'Addresses'
198198
])
199199
->setProperty('work_address')
200-
->setConditions(['WorkAddress.label' => 'Work'])
200+
->setConditions(['WorkAddresses.label' => 'Work'])
201201
->setDependent(true);
202202
}
203203
}
204204

205205
.. note::
206206

207207
If a column is shared by multiple hasOne associations, you must qualify it with the association alias.
208-
In the above example, the 'label' column is qualified with the 'HomeAddress' and 'WorkAddress' aliases.
208+
In the above example, the 'label' column is qualified with the 'HomeAddresses' and 'WorkAddresses' aliases.
209209

210210
Possible keys for hasOne association arrays include:
211211

0 commit comments

Comments
 (0)