blob: f6ac3c8cc13086e1ff516efe12f643b08f6b29d8 [file] [log] [blame]
<?php
/*
Example Entity feed for Google Order Redirect.
*/
require dirname(__FILE__).'/vendor/autoload.php';
use Madden\Ingestion\EntityFeed;
use Madden\Ingestion\Entity;
use Madden\Ingestion\GeoCoordinates;
use Madden\Ingestion\PostalAddress;
function createFeed() {
// Create Entity by using setter methods
$entity = new Entity();
$entity->setEntityId("merchant-1");
$entity->setName("Mo's Dinner");
$entity->setTelephone("+14567891234");
$entity->setUrl("http://moesdinner.com");
$entityLocation = new GeoCoordinates();
$entityLocation->setLatitude(41.525588);
$entityLocation->setLongitude(-90.507067);
$entity->setLocation($entityLocation);
$entityAddress = new PostalAddress();
$entityAddress->setCountry("US");
$entityAddress->setLocality("Mountain View");
$entityAddress->setRegion("CA");
$entityAddress->setPostalCode("94043");
$entityAddress->setStreetAddress("1600 Amphitheatre Pkwy");
$entityLocation->setAddress($entityAddress);
# Add Entity to feed data
$feed = new EntityFeed();
$feed->setData(array($entity));
# Serialize to JSON
return $feed->serializeToJsonString();
}
$feedJSON = createFeed();
echo $feedJSON;