Skip to content

Commit

Permalink
Merge pull request #28 from discovery-tecnologia/develop
Browse files Browse the repository at this point in the history
Adicionando mapeamento para trazer as cidades relacionadas com o estado
  • Loading branch information
dilowagner authored Feb 24, 2019
2 parents 718178d + 22babc8 commit d758b28
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion src/Requests/Address/State.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
namespace Dsc\MercadoLivre\Requests\Address;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use JMS\Serializer\Annotation as JMS;

class State
Expand Down Expand Up @@ -35,7 +37,19 @@ class State
*/
private $country;

//TODO Mapear as cidades se necessário
/**
* @var ArrayCollection
* @JMS\Type("ArrayCollection<Dsc\MercadoLivre\Requests\Address\City>")
*/
private $cities;

/**
* State constructor.
*/
public function __construct()
{
$this->cities = new ArrayCollection();
}

/**
* @return string
Expand Down Expand Up @@ -108,4 +122,42 @@ public function setCountry(Country $country)
$this->country = $country;
return $this;
}

/**
* @return Collection
*/
public function getCities()
{
return $this->cities;
}

/**
* @param City $city
* @return $this
*/
public function addCity(City $city)
{
$this->cities->add($city);
return $this;
}

/**
* @param City $city
* @return $this
*/
public function removeCity(City $city)
{
$this->cities->remove($city);
return $this;
}

/**
* @param Collection $cities
* @return State
*/
public function setCities(Collection $cities)
{
$this->cities = $cities;
return $this;
}
}

0 comments on commit d758b28

Please sign in to comment.