1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/tests/Doctrine/Tests/Models/CMS/CmsUser.php

69 lines
1.7 KiB
PHP
Raw Normal View History

2008-02-09 02:20:35 +03:00
<?php
namespace Doctrine\Tests\Models\CMS;
/**
* @DoctrineEntity
* @DoctrineTable(name="cms_users")
*/
class CmsUser
2008-02-09 02:20:35 +03:00
{
/**
* @DoctrineId
* @DoctrineColumn(type="integer")
* @DoctrineIdGenerator("auto")
*/
public $id;
/**
* @DoctrineColumn(type="varchar", length=50)
*/
public $status;
/**
* @DoctrineColumn(type="varchar", length=255)
*/
public $username;
/**
* @DoctrineColumn(type="varchar", length=255)
*/
public $name;
/**
* @DoctrineOneToMany(targetEntity="CmsPhonenumber", mappedBy="user", cascade={"save", "delete"})
*/
public $phonenumbers;
/**
* @DoctrineOneToMany(targetEntity="CmsArticle", mappedBy="user")
*/
public $articles;
/**
* @DoctrineOneToOne(targetEntity="CmsAddress", mappedBy="user", cascade={"save"})
*/
public $address;
/**
* @DoctrineManyToMany(targetEntity="CmsGroup", cascade={"save"})
* @DoctrineJoinTable(name="cms_users_groups",
joinColumns={{"name"="user_id", "referencedColumnName"="id"}},
inverseJoinColumns={{"name"="group_id", "referencedColumnName"="id"}})
*/
public $groups;
/**
* Adds a phonenumber to the user.
*
* @param CmsPhonenumber $phone
*/
public function addPhonenumber(CmsPhonenumber $phone) {
$this->phonenumbers[] = $phone;
$phone->user = $this;
}
2009-01-29 20:00:44 +03:00
public function removePhonenumber($index) {
if (isset($this->phonenumbers[$index])) {
$ph = $this->phonenumbers[$index];
unset($this->phonenumbers[$index]);
$ph->user = null;
return true;
}
return false;
}
}