Created
June 15, 2011 19:49
-
-
Save sveneisenschmidt/1027938 to your computer and use it in GitHub Desktop.
Expose Entities via annotations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MyCompany\MyBundle\Entity; | |
use Hahaitsfate\ApiBundle\Mapping\Annotations as Api; | |
/** | |
* @API\Collection(name="products") | |
* @ORM\Table(name="products") | |
* @ORM\Entity | |
*/ | |
class Product | |
{ | |
/** | |
* @API\Expose(name="id", access="readonly") | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $id; | |
/** | |
* @API\Expose | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $title; | |
/** | |
* @API\Expose(name="category_id") | |
* @ORM\ManyToOne( | |
* targetEntity="MyCompany\MyBundle\Entity\ProductCategory", | |
* inversedBy="products" | |
* ) | |
*/ | |
private $category; | |
public function getId() | |
{ | |
return $this->id; | |
} | |
public function setTitle($title) | |
{ | |
$this->title = $title; | |
} | |
public function getTitle() | |
{ | |
return $this->title; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hahaitsfate_api: | |
mappings: | |
MyCompanyMyBundle: | |
dir: Entity/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment