Created
April 14, 2010 15:35
-
-
Save jwage/365959 to your computer and use it in GitHub Desktop.
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
<?php | |
namespace Doctrine\Tests\ORM\Mapping; | |
/** | |
* @Entity | |
* @HasLifecycleCallbacks | |
* @Table(name="cms_users") | |
*/ | |
class User | |
{ | |
/** @Id @Column(type="integer") @generatedValue(strategy="AUTO") */ | |
public $id; | |
/** | |
* @Column(length=50, nullable=true, unique=true) | |
*/ | |
public $name; | |
/** | |
* @Column(name="user_email", columnDefinition="CHAR(32) NOT NULL") | |
*/ | |
public $email; | |
/** | |
* @OneToOne(targetEntity="Address", cascade={"remove"}, inversedBy="user") | |
* @JoinColumn(onDelete="CASCADE", onUpdate="CASCADE") | |
*/ | |
public $address; | |
/** | |
* @OneToMany(targetEntity="Phonenumber", mappedBy="user", cascade={"persist"}) | |
* @OrderBy({"number"="ASC"}) | |
*/ | |
public $phonenumbers; | |
/** | |
* @ManyToMany(targetEntity="Group", cascade={"all"}) | |
* @JoinTable(name="cms_user_groups", | |
* joinColumns={@JoinColumn(name="user_id", referencedColumnName="id", nullable=false, unique=false)}, | |
* inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id", columnDefinition="INT NULL")} | |
* ) | |
*/ | |
public $groups; | |
/** | |
* @PrePersist | |
*/ | |
public function doStuffOnPrePersist() | |
{ | |
} | |
/** | |
* @PrePersist | |
*/ | |
public function doOtherStuffOnPrePersistToo() { | |
} | |
/** | |
* @PostPersist | |
*/ | |
public function doStuffOnPostPersist() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment