| @@ 21-61 (lines=41) @@ | ||
| 18 | /** |
|
| 19 | * @ORM\Entity |
|
| 20 | */ |
|
| 21 | class Beer implements SearchableEntity { |
|
| 22 | ||
| 23 | ||
| 24 | public static $index = true; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @ORM\Id |
|
| 28 | * @ORM\Column(type="integer") |
|
| 29 | * @ORM\GeneratedValue(strategy="IDENTITY") |
|
| 30 | */ |
|
| 31 | private $id; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @ORM\Column(name="title", type="string", length=128) |
|
| 35 | */ |
|
| 36 | private $title; |
|
| 37 | ||
| 38 | public function getId() { |
|
| 39 | return $this->id; |
|
| 40 | } |
|
| 41 | ||
| 42 | public function getTitle() { |
|
| 43 | return $this->title; |
|
| 44 | } |
|
| 45 | ||
| 46 | public function setTitle($title) { |
|
| 47 | $this->title = $title; |
|
| 48 | return $this; |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * |
|
| 53 | * {@inheritDoc} |
|
| 54 | * |
|
| 55 | * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity() |
|
| 56 | */ |
|
| 57 | public function indexEntity(Document &$document) { |
|
| 58 | $document->addField(Document::FIELD_TITLE, $this->getTitle()); |
|
| 59 | return self::$index; |
|
| 60 | } |
|
| 61 | } |
|
| @@ 21-56 (lines=36) @@ | ||
| 18 | /** |
|
| 19 | * @ORM\Entity |
|
| 20 | */ |
|
| 21 | class Car implements SearchableEntity { |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @ORM\Id @ORM\Column(type="string") |
|
| 25 | */ |
|
| 26 | private $title; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @ORM\Id @ORM\Column(type="integer") |
|
| 30 | */ |
|
| 31 | private $year; |
|
| 32 | ||
| 33 | public function __construct($title, $year) { |
|
| 34 | $this->title = $title; |
|
| 35 | $this->year = $year; |
|
| 36 | } |
|
| 37 | ||
| 38 | public function getTitle() { |
|
| 39 | return $this->title; |
|
| 40 | } |
|
| 41 | ||
| 42 | public function getYearOfProduction() { |
|
| 43 | return $this->year; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * |
|
| 48 | * {@inheritDoc} |
|
| 49 | * |
|
| 50 | * @see \StingerSoft\EntitySearchBundle\Model\SearchableEntity::indexEntity() |
|
| 51 | */ |
|
| 52 | public function indexEntity(Document &$document) { |
|
| 53 | $document->addField(Document::FIELD_TITLE, $this->getTitle()); |
|
| 54 | return self::$index; |
|
| 55 | } |
|
| 56 | } |
|