Countries
Countries are a part of the Addressing concept. The Country entity represents a real country that your shop is willing to sell its goods in (for example the UK). It has an ISO code to be identified easily (ISO 3166-1 alpha-2).
Countries might also have Provinces, which are in fact a general name for an administrative division, within a country. Therefore we understand provinces as states of the USA, voivodeships of Poland, or Bundesländer of Germany.
How to add a country?
To give you a better insight into Countries, let’s have a look on how to prepare and add a Country to the system programmatically. We will do it with a province at once.
You will need factories for countries and provinces to create them:
To the newly created objects assign codes.
Provinces may be added to a country via a collection. Create one and add the province object to it and using the prepared collection add the province to the Country.
You can of course simply add a single province:
Finally, you will need a repository for countries to add the country to your system.
From now on the country will be available to use in your system.
Last updated