diff --git a/README.md b/README.md index 57c641a..b6d4828 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,70 @@ # fos-rest-behavior -TODO +This a propel behavior to auto-generate methods of [FOSRestBundle](http://symfony.com/doc/current/bundles/FOSRestBundle/index.html). + +## Installation + +`composer require deblan/fos-rest-behavior` + +## How to + + +``` + + + + + + + + + + +
+``` + +After the model generation, the abstract class `Foo` will be updated with new annotations and methods: + +``` +/** + * [...] + * + * @JMS\Serializer\Annotation\ExclusionPolicy("all") + */ +abstract class Foo implements ActiveRecordInterface +{ + ... + + /** + * @JMS\Serializer\Annotation\SerializedName("id") + * @JMS\Serializer\Annotation\Groups({"all"}) + * @JMS\Serializer\Annotation\VirtualProperty + */ + public function getRestId() + { + return $this->getId(); + } + + /** + * @JMS\Serializer\Annotation\SerializedName("label") + * @JMS\Serializer\Annotation\Groups({"myGroup"}) + * @JMS\Serializer\Annotation\VirtualProperty + */ + public function getRestLabel() + { + return $this->getLabel(); + } + + /** + * @JMS\Serializer\Annotation\SerializedName("is_active") + * @JMS\Serializer\Annotation\Groups({"myGroup", "anotherGroup"}) + * @JMS\Serializer\Annotation\VirtualProperty + */ + public function getRestIsActive() + { + return $this->getIsActive(); + } + + ... +} +```