I'm using Doctrine 2 to connect to and generate objects from a mysql database that is a shared backend to a filemaker application. As such, i cannot let Doctrine completely automate the table generation and need to customise the mapping from class property to db table fields. The following annotation, by default, maps to the table field 'pubofficeid_id'. I need it to map to 'pubofficeid'. Is this possible开发者_如何学运维? I can change anything in the annotation or the class property name.
/**
* @ManyToOne (targetEntity="Hs_Profile_Staff", inversedBy="staffPubRelation", cascade={"persist"})
*/
public $pubofficeid;
The One-To-Many, Bidirectional example in the documentation spells it out pretty clearly.
class Feature
{
// ...
/**
* @ManyToOne(targetEntity="Product", inversedBy="features")
* @JoinColumn(name="product_id", referencedColumnName="id")
*/
private $product;
// ...
}
精彩评论