diff --git a/Tests/DocumentXmlTest.php b/Tests/DocumentXmlTest.php
index c8db5ca..6e3c6a4 100644
--- a/Tests/DocumentXmlTest.php
+++ b/Tests/DocumentXmlTest.php
@@ -44,6 +44,7 @@ public function test_general_xml()
{
$ad = (new Ad)
->setId('1')
+ ->setAdsType('premium')
->setCity('Córdoba')
->setContent('Nokia 1100')
->setDistrict((new District)->setDistrict('Nueva Córdoba')->setZone('centro'))
@@ -75,6 +76,7 @@ public function test_vehicle_xml()
{
$vehicle = (new Vehicle)
->setId('11111111')
+ ->setAdsType('premium')
->setCity('Córdoba')
->setColor('champagne')
->setConfort('aire acondicionado, stereo dvd, vidrios polarizados')
diff --git a/Tests/Entity/AdTest.php b/Tests/Entity/AdTest.php
index 1030c49..b5f9711 100644
--- a/Tests/Entity/AdTest.php
+++ b/Tests/Entity/AdTest.php
@@ -31,6 +31,8 @@ public function test_getters_and_setters_ok()
$test_phone = new Phone;
$this->assertEquals($ad, $ad->setId('test_id'));
$this->assertEquals('test_id', $ad->getId());
+ $this->assertEquals($ad, $ad->setAdsType('test_ads_type'));
+ $this->assertEquals('test_ads_type', $ad->getAdsType());
$this->assertEquals($ad, $ad->setCity('test_city'));
$this->assertEquals('test_city', $ad->getCity());
$this->assertEquals($ad, $ad->setContent('test_content'));
@@ -63,6 +65,7 @@ public function requiredValueDataProvider()
{
return [
['Id', 'id'],
+ ['AdsType', 'ads_type'],
['City', 'city'],
['Content', 'content'],
['Email', 'email'],
diff --git a/Tests/Entity/VehicleTest.php b/Tests/Entity/VehicleTest.php
index 1729c27..e7d92ad 100644
--- a/Tests/Entity/VehicleTest.php
+++ b/Tests/Entity/VehicleTest.php
@@ -37,6 +37,8 @@ public function test_getters_and_setters_ok()
$test_district = new District;
$this->assertEquals($vehicle, $vehicle->setId('test_id'));
$this->assertEquals('test_id', $vehicle->getId());
+ $this->assertEquals($vehicle, $vehicle->setAdsType('test_ads_type'));
+ $this->assertEquals('test_ads_type', $vehicle->getAdsType());
$this->assertEquals($vehicle, $vehicle->setCity('test_city'));
$this->assertEquals('test_city', $vehicle->getCity());
$this->assertEquals($vehicle, $vehicle->setColor('test_color'));
@@ -93,6 +95,7 @@ public function requiredValueDataProvider()
{
return [
['Id', 'id'],
+ ['AdsType', 'ads_type'],
['City', 'city'],
['Content', 'content'],
['Email', 'email'],
diff --git a/Tests/xml_samples/general.xml b/Tests/xml_samples/general.xml
index 5ef5267..8c91042 100644
--- a/Tests/xml_samples/general.xml
+++ b/Tests/xml_samples/general.xml
@@ -18,5 +18,6 @@
+
diff --git a/Tests/xml_samples/vehicle.xml b/Tests/xml_samples/vehicle.xml
index a940270..eba37a7 100644
--- a/Tests/xml_samples/vehicle.xml
+++ b/Tests/xml_samples/vehicle.xml
@@ -18,6 +18,7 @@
+
diff --git a/resources/config/serializer/Zephia.LaVozFeed.Entity.Ad.yml b/resources/config/serializer/Zephia.LaVozFeed.Entity.Ad.yml
index e39afb2..f0cef2b 100644
--- a/resources/config/serializer/Zephia.LaVozFeed.Entity.Ad.yml
+++ b/resources/config/serializer/Zephia.LaVozFeed.Entity.Ad.yml
@@ -1,11 +1,16 @@
Zephia\LaVozFeed\Entity\Ad:
access_type: public_method
accessor_order: custom
- custom_accessor_order: [id, type, title, content, region, city, phone, email, operation, status, price, payment, district, pictures, modify]
+ custom_accessor_order: [id, type, title, content, region, city, phone, email, operation, status, price, payment, district, pictures, modify, ads_type]
exclusion_policy: NONE
properties:
id:
type: "string"
+ ads_type:
+ type: "string"
+ accessor:
+ getter: getAdsType
+ setter: setAdsType
city:
type: "string"
content:
diff --git a/resources/config/serializer/Zephia.LaVozFeed.Entity.Vehicle.yml b/resources/config/serializer/Zephia.LaVozFeed.Entity.Vehicle.yml
index 0b0ad0e..e347ae2 100644
--- a/resources/config/serializer/Zephia.LaVozFeed.Entity.Vehicle.yml
+++ b/resources/config/serializer/Zephia.LaVozFeed.Entity.Vehicle.yml
@@ -1,7 +1,7 @@
Zephia\LaVozFeed\Entity\Vehicle:
access_type: public_method
accessor_order: custom
- custom_accessor_order: [id, type, title, content, region, city, phone, email, operation, status, price, payment, district, pictures, modify, model, receives_lesser_value, year, kilometers, fuel, version, doors, transmission, segment, color, confort, security]
+ custom_accessor_order: [id, type, title, content, region, city, phone, email, operation, status, price, payment, district, pictures, modify, ads_type, model, receives_lesser_value, year, kilometers, fuel, version, doors, transmission, segment, color, confort, security]
exclusion_policy: NONE
properties:
color:
diff --git a/src/Entity/Ad.php b/src/Entity/Ad.php
index de9ab08..6b116d5 100644
--- a/src/Entity/Ad.php
+++ b/src/Entity/Ad.php
@@ -25,6 +25,11 @@ class Ad extends Entity
*/
private $id = '';
+ /**
+ * @var string
+ */
+ private $ads_type = '';
+
/**
* @var string
*/
@@ -123,6 +128,34 @@ public function setId($id)
return $this;
}
+ /**
+ * Get Ads Type
+ *
+ * @return string
+ */
+ public function getAdsType()
+ {
+ if (empty($this->ads_type)) {
+ throw new LogicException(
+ sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'ads_type')
+ );
+ }
+ return $this->ads_type;
+ }
+
+ /**
+ * Set Ads Type
+ *
+ * @param string $ads_type
+ *
+ * @return Ad
+ */
+ public function setAdsType($ads_type)
+ {
+ $this->ads_type = $ads_type;
+ return $this;
+ }
+
/**
* Get City
*