This a propel behavior to auto-generate methods of FOSRestBundle.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Simon Vieille acb3935103 Documentation 2 years ago
src/Deblan/Propel/Behavior Annotation issue fixed 2 years ago
LICENSE.md licence 2 years ago
README.md Documentation 2 years ago
composer.json Annotation issue fixed 2 years ago

README.md

fos-rest-behavior

This a propel behavior to auto-generate methods of FOSRestBundle.

Installation

composer require deblan/fos-rest-behavior

How to

<table name="foo">
    <column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true" />
    <column name="label" type="VARCHAR" size="256"/>
    <column name="is_active" type="BOOLEAN" size="1"/>

    <behavior name="Deblan\Propel\Behavior\FOSRestBehavior">
        <parameter name="id" value="all"/>
        <parameter name="label" value="myGroup"/>
        <parameter name="is_active" value="myGroup, anotherGroup"/>
    </behavior>
</table>

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();
    }

    ...
}