/**
  * @param Listing $listing
  * @param string $name
  * @param \simple_html_dom_node $domRow
  */
 protected function parseAmenityByType(Listing $listing, $name, $domRow)
 {
     foreach ($domRow->find('div ul li') as $domValue) {
         /** @var \simple_html_dom_node $domValue */
         $value = trim($domValue->text());
         if (!empty($value)) {
             $amenity = new ListingAmenity();
             $amenity->setName($name)->setValue($value);
             $listing->addAmenity($amenity);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Adds amenity.
  *
  * @param ListingAmenity $amenity
  */
 public function addAmenity($amenity)
 {
     $amenity->setListing($this);
     $this->getAmenityList()->add($amenity);
 }