Q:

doctrine property mapping

I just started working with symfony and doctrine.  I have a simple entity which has one property is not tied with the database.  This property should contain the contents of the xml file (I wanna make xml file, when doctrine add rows to the database). 
/**
 * Layouts
 *
 * @ORM\Table(name="layouts")
 * @ORM\Entity
 * @ORM\HasLifecycleCallbacks()
 */
class Layouts
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="SEQUENCE")
     * @ORM\SequenceGenerator(sequenceName="layouts_id_seq", allocationSize=1, initialValue=1)
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=false)
     */
    private $name;

    /**
     * ??????? 
     */
    private $template_body;
    ...
}

How to describe $template_body property?  Without leaving the property description, I ran into a problem - the doctrine does not cause preUpdate method when I edit this property in the form. 

A:

You can do that my simply flagging a PreUpdate method in your class, which in turn begins working on your $template_body variable. 
Please change  
* @ORM\HasLifecycleCallbacks() 

to  
* @ORM\HasLifecycleCallbacks 

and create a function like so..
/**
 * @PreUpdate
 */
public function myUpdateFunction()
{
   // Do stuff
}

