1. Go to this page and download the library: Download biberlabs/ddd-embeddables 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/ */
biberlabs / ddd-embeddables example snippets
namespace MyApp\Entity;
use Doctrine\ORM\Mapping as ORM;
use DDD\Embeddable\EmailAddress;
/**
* @ORM\Entity
*/
class User {
/**
* @ORM\Embedded(class="DDD\Embeddable\EmailAddress")
*/
private $email;
// Returns an EmailAddress instance, not a string
public function getEmail();
// Use type-hinting if you need a setter
public function setEmail(EmailAddress $email);
}
if($company->hasMap()) {
$latLng = $company->getAddress()->getGeoPoint()->toArray();
//..
}
class Company
{
// ...
/**
* Returns a boolean TRUE if the geolocation of the company is known,
* FALSE otherwise.
*
* @return bool
*/
public function hasMap()
{
return $this->getAddress()->getGeoPoint() !== null;
}
}