| <?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; | |