Get the associations collection for this table.
public associations ( ) : Cake\ORM\AssociationCollection | ||
return | Cake\ORM\AssociationCollection | The collection of association objects. |
class UsersTable extends Table { public function initialize(array $config) { $this->hasOne('Profiles'); } } class ProfilesTable extends Table { public function initialize(array $config) { $this->belongsTo('Users'); } }
class AlbumsTable extends Table { public function initialize(array $config) { $this->hasMany('Photos'); } } class PhotosTable extends Table { public function initialize(array $config) { $this->belongsTo('Albums'); } }
class UsersTable extends Table { public function initialize(array $config) { $this->belongsTo('Groups'); } } class GroupsTable extends Table { public function initialize(array $config) { $this->hasMany('Users'); } }
class OrdersTable extends Table { public function initialize(array $config) { $this->belongsToMany('Products'); } } class ProductsTable extends Table { public function initialize(array $config) { $this->belongsToMany('Orders'); } }The above examples show how to use different types of associations in CakePHP ORM. They are a part of the CakePHP package library.
public associations ( ) : Cake\ORM\AssociationCollection | ||
return | Cake\ORM\AssociationCollection | The collection of association objects. |