PHP code example of lyssal / simple-location-bundle
1. Go to this page and download the library: Download lyssal/simple-location-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lyssal / simple-location-bundle example snippets
namespace App\Entity\Location;
use Doctrine\ORM\Mapping as ORM;
use Lyssal\SimpleLocationBundle\Doctrine\Repository\LocationRepository;
use Lyssal\SimpleLocationBundle\Entity\Location as LyssalLocation;
#[ORM\Entity(repositoryClass: LocationRepository::class)]
class Location extends LyssalLocation
{
// If you want to add properties
}
$continent = (new LocationType())->setName('Continent');
$country = (new LocationType())->setName('Country')->addParent($continent);
$city = (new LocationType())->setName('City')->addParent($country);
$europa = (new Location())->setName('Europe')->setType($continent);
$america = (new Location())->setName('America')->setType($continent);
$asia = (new Location())->setName('Asia')->setType($continent);
$france = (new Location())->setName('France')->setType($country)->addParent($europa);
$italy = (new Location())->setName('Italy')->setType($country)->addParent($europa);
$sovietUnion = (new Location())->setName('Soviet Union')->setType($country)->addParent($europa)->addParent($asia);
$paris = (new Location())->setName('Paris')->setType($city)->addParent($france);
$countrySet = (new LocationType())->setName('Country set')->addChild($country);
$northAmerica = (new Location())->setName('North America')->setType($countrySet)->addParent($america);
$usa = (new Location())->setName('United States of America')->setType($country)->addParent($america)->addParent($northAmerica);
$europeanUnion = (new Location())->setName('European Union')->setType($countrySet)->addParent($europa)->addChild($france)->addChild($italy);
$germany = (new Location())->setName('Germany')->setType($country)->addParent($europa)->addParent($europeanUnion);
$westGermany = (new Location())->setName('Federal Republic of Germany')->setType($country)->addParent($germany)->addParent($europa)->addParent($europeanUnion);
$eastGermany = (new Location())->setName('German Democratic Republic')->setType($country)->addParent($sovietUnion)->addParent($germany)->addParent($europa);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.