Hello. Is it good practice to have two objects (classes) which contain each other as class properties?
Say:
class Country
{
public $capital;
}
class City
{
public $name;
public $country;
}
$uk = new Country();
$london = new City();
$london->country = $uk;
$uk->capital = $london;
The question is theoretical and isn’t related to any framework. Technically it seems OK because in memory there will be just pointers to respective objects. Is it good practice or should I use another apporach?