本文整理汇总了PHP中Place::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::populate方法的具体用法?PHP Place::populate怎么用?PHP Place::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::populate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPopulate
public function testPopulate()
{
$subCategory = new Subcategory();
$subCategory->setId(1234);
$subCategory->setName("Self Service");
$category = new Category();
$category->setId(12);
$category->setName("Restaurantes");
$category->setSubCategory($subCategory);
$city = new City();
$city->setCountry("Brasil");
$city->setState("SP");
$city->setName("São Paulo");
$address = new Address();
$address->setCity($city);
$address->setComplement("1 Andar");
$address->setDistrict("Vila Olímpia");
$address->setNumber("129");
$address->setStreet("Rua Funchal");
$address->setZipcode("04551-069");
$gasStation = new GasStation(array('price_gas' => 1, 23, 'price_vodka' => 23, 45));
$placeInfo = new PlaceInfo();
$placeInfo->setGasStation($gasStation);
$data = new \stdClass();
$data->id = 123;
$data->name = "Chegamos!";
$data->average_rating = 4;
$data->review_count = 3;
$data->category = $category;
$data->subcategory = $subCategory;
$data->address = $address;
$data->point->lat = "-23.529366";
$data->point->lng = "-47.467117";
$data->main_url = "http://chegamos.com/";
$data->other_url = "http://chegamos.com.br/";
$data->icon_url = "http://chegamos.com/img/icon.png";
$data->description = "Description";
$data->created = "01/12/2010 16:19";
$data->phone = "11 2222-3333";
$data->extended = $placeInfo;
$data->num_visitors = 1024;
$data->num_photos = 5;
$this->object->populate($data);
$this->assertEquals(123, $this->object->getId());
$this->assertEquals("Chegamos!", $this->object->getName());
$this->assertEquals(4, $this->object->getAverageRating());
$this->assertEquals("Bom", $this->object->getAverageRatingString());
$this->assertEquals(3, $this->object->getReviewCount());
$this->assertEquals("app\\models\\Category", \get_class((object) $this->object->getCategory()));
$this->assertEquals("Restaurantes - Self Service", (string) $this->object->getCategory());
$this->assertEquals("app\\models\\Address", \get_class((object) $this->object->getAddress()));
$this->assertEquals("Rua Funchal, 129 - Vila Olímpia<br/>São Paulo - SP", (string) $this->object->getAddress());
$this->assertEquals("-23.529366,-47.467117", (string) $this->object->getPoint());
$this->assertEquals("http://chegamos.com/", $this->object->getMainUrl());
$this->assertEquals("http://chegamos.com.br/", $this->object->getOtherUrl());
$this->assertEquals("http://chegamos.com/img/icon.png", $this->object->getIconUrl());
$this->assertEquals("Description", $this->object->getDescription());
$this->assertEquals("01/12/2010 16:19", $this->object->getCreated());
$this->assertEquals("11 2222-3333", $this->object->getPhone());
$this->assertEquals("app\\models\\PlaceInfo", \get_class((object) $this->object->getPlaceInfo()));
$this->assertEquals(1024, $this->object->getNumVisitors());
$this->assertEquals(5, $this->object->getNumPhotos());
}