1. Go to this page and download the library: Download crovitche/swiss-geo-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/ */
crovitche / swiss-geo-bundle example snippets
declare(strict_types=1);
namespace App\Entity;
use Crovitche\SwissGeoBundle\Entity\BuildingAddress;
use Doctrine\ORM\Mapping as ORM;
//...
#[ORM\Entity(CustomerRepository::class), ORM\Table("Customer")]
#[ORM\Index(columns: ["egaid"], name: "IX___Customer___building_address")]
class Customer
{
//...
#[ORM\ManyToOne(BuildingAddress::class)]
#[ORM\JoinColumn("egaid", "egaid", false, true, "SET NULL")]
private ?BuildingAddress $postalAddress = null;
}
public function up(Schema $schema): void
{
// ...
$this->addSql(/** @lang MySQL */'
ALTER TABLE Building_address
ADD CONSTRAINT CK___Building_address___building_name__xor__address_number
CHECK ((building_name IS NOT NULL XOR address_number IS NOT NULL) OR (building_name IS NULL AND address_number IS NULL));
');
// ...
}
public function down(Schema $schema): void
{
// ...
$this->addSql(/** @lang MySQL */'
ALTER TABLE Building_address DROP CONSTRAINT CK___Building_address___building_name__xor__address_number;
');
// ...
}
public function isTransactional(): bool
{
return false;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.