2009-07-01 17:11:45 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Models\ECommerce;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Describes a product feature.
|
|
|
|
*
|
|
|
|
* @author Giorgio Sironi
|
|
|
|
* @Entity
|
|
|
|
* @Table(name="ecommerce_features")
|
|
|
|
*/
|
|
|
|
class ECommerceFeature
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @Column(type="integer")
|
|
|
|
* @Id
|
2010-04-10 02:00:36 +04:00
|
|
|
* @GeneratedValue
|
2009-07-01 17:11:45 +04:00
|
|
|
*/
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
/**
|
2010-04-10 02:00:36 +04:00
|
|
|
* @Column(length=50)
|
2009-07-01 17:11:45 +04:00
|
|
|
*/
|
|
|
|
private $description;
|
|
|
|
|
|
|
|
/**
|
2010-04-10 02:00:36 +04:00
|
|
|
* @ManyToOne(targetEntity="ECommerceProduct", inversedBy="features")
|
2009-07-01 17:11:45 +04:00
|
|
|
* @JoinColumn(name="product_id", referencedColumnName="id")
|
|
|
|
*/
|
|
|
|
private $product;
|
|
|
|
|
|
|
|
public function getId() {
|
|
|
|
return $this->id;
|
|
|
|
}
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-07-01 17:11:45 +04:00
|
|
|
public function getDescription() {
|
|
|
|
return $this->description;
|
|
|
|
}
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-07-01 17:11:45 +04:00
|
|
|
public function setDescription($description) {
|
|
|
|
$this->description = $description;
|
|
|
|
}
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-07-01 17:11:45 +04:00
|
|
|
public function setProduct(ECommerceProduct $product) {
|
2009-07-02 15:48:44 +04:00
|
|
|
$this->product = $product;
|
2009-07-01 17:11:45 +04:00
|
|
|
}
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-07-01 17:11:45 +04:00
|
|
|
public function removeProduct() {
|
|
|
|
if ($this->product !== null) {
|
|
|
|
$product = $this->product;
|
|
|
|
$this->product = null;
|
|
|
|
$product->removeFeature($this);
|
|
|
|
}
|
|
|
|
}
|
2011-12-20 01:56:19 +04:00
|
|
|
|
2009-07-01 17:11:45 +04:00
|
|
|
public function getProduct() {
|
|
|
|
return $this->product;
|
|
|
|
}
|
|
|
|
}
|