Skip to content

Instantly share code, notes, and snippets.

@kdambekalns
Created February 14, 2013 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdambekalns/4951727 to your computer and use it in GitHub Desktop.
Save kdambekalns/4951727 to your computer and use it in GitHub Desktop.
Example for mapping the TYPO3 CMS fe_users table to a TYPO3 Flow domain model
<?php
namespace Acme\Demo\Domain\Model;
/* *
* This script belongs to the TYPO3 Flow package "Acme.Demo". *
* *
* */
use TYPO3\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
/**
* A FE User (mapped to fe_users)
*
* @Flow\Scope("prototype")
* @Flow\Entity
* @ORM\Table(name="fe_users")
*/
class FrontendUser {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @var integer
*/
protected $uid;
/**
* @var integer
*/
protected $pid;
/**
* @var string
* @ORM\Column(length=50)
*/
protected $username;
/**
* @var boolean
* @ORM\Column(name="disable", type="integer")
*/
protected $disabled;
/**
* @var boolean
* @ORM\Column(type="integer")
*/
protected $deleted = 0;
/**
* The address
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"minimum"=0,"maximum"=80})
* @ORM\Column(length=80)
*/
protected $address = "";
/**
* The email
*
* @var string
* @ORM\Column(name="email")
*/
protected $primaryEmailAddress = "";
/**
* The first_name
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"maximum"=80})
* @ORM\Column(name="first_name", length=80)
*/
protected $firstName = "";
/**
* The last_name
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"maximum"=80})
* @ORM\Column(name="last_name", length=50,nullable=true)
*/
protected $lastName = "";
/**
* The fax
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"minimum"=0,"maximum"=80})
* @ORM\Column(length=80)
*/
protected $fax = "";
/**
* The telephone
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"minimum"=0,"maximum"=80})
* @ORM\Column(length=80)
*/
protected $telephone = "";
/**
* The name
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"minimum"=0,"maximum"=80})
* @ORM\Column(name="name", length=80)
*/
protected $fullName = "";
/**
* The title
*
* @var string
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={"minimum"=0,"maximum"=80})
* @ORM\Column(length=80)
*/
protected $title = "";
/**
* The gender
*
* @var integer
* @Flow\Validate(type="Integer")
* @ORM\Column(length=80)
*/
protected $gender = 0;
/**
* The Wec_Staff tag
*
* @var integer
* @Flow\Validate(type="Integer")
* @ORM\Column(length=80)
*/
protected $tx_wecstaffdirectory_in = 1;
/**
* The user Frontengroup he is belonging
*
* @var string
* @Flow\Validate(type="Text")
* @ORM\Column(name="usergroup")
*/
protected $userGroup = "";
public function __toString() {
return (string)$this->uid;
}
/**
* @param integer $pid
*/
public function setPid($pid) {
$this->pid = $pid;
}
/**
* Get the Staff's address
*
* @return string The Staff's address
*/
public function getAddress() {
return $this->address;
}
/**
* Set the Staff Address
*
* @param string $address
* @return void
*/
public function setAddress($address = "") {
$this->address = $address;
}
/**
* Get the Staff's email
*
* @return string The Staff's email
*/
public function getPrimaryEmailAddress() {
return $this->primaryEmailAddress;
}
/**
* Set the Staff's Primary Email
*
* @param string $email
* @return void
*/
public function setEmail($email) {
$this->primaryEmailAddress = $email;
}
/**
* Get the Staff's username
*
* @return string The Staff's last_name
*/
public function getUsername() {
return $this->username;
}
/**
* Set the Users userName
*
* @var string $userName
* @return void
*/
public function setUsername($username) {
$this->username = $username;
}
/**
* Get the Staff's first_name
*
* @return string The Staff's first_name
*/
public function getFirstname() {
return $this->firstName;
}
/**
* Set the Users Firstname
*
* @var string $firstName
* @return void
*/
public function setFirstname($firstname) {
$this->firstName = $firstname;
}
/**
* Get the Staff's last_name
*
* @return string The Staff's last_name
*/
public function getLastName() {
return $this->lastName;
}
/**
* Set the Users lastname
*
* @var string $lastname
* @return void
*/
public function setLastName($lastName) {
$this->lastName = $lastName;
}
/**
* Get the Staff's fax
*
* @return string The Staff's fax
*/
public function getFax() {
return $this->fax;
}
/**
* Set the Users fax number
*
* @var string $fax
* @return void
*/
public function setFax($fax = "") {
$this->fax = $fax;
}
/**
* Get the Staff's telephone
*
* @return string The Staff's telephone
*/
public function getTelephone() {
return $this->telephone;
}
/**
* Set the Users Phone number
*
* @var string $telephone
* @return void
*/
public function setTelephone($telephone = "") {
$this->telephone = $telephone;
}
/**
* Get the Staff's full_name
*
* @return string The Staff's full_name
*/
public function getFullName() {
return $this->fullName;
}
/**
* Set the Users
*
* @var string $fullname
* @return void
*/
public function setFullname($fullName = "") {
$this->fullName = $fullName;
}
/**
* Get the Staff's title
*
* @return string The Staff's title
*/
public function getTitle() {
return $this->title;
}
/**
* Set the Users title
*
* @var string $title
* @return void
*/
public function setTitle($title = "") {
$this->title = $title;
}
/**
* Get the User frontendgroup belonging
*
* @return string The User frontendgroup Belonging
*/
public function getUserGroup() {
return $this->userGroup;
}
/**
* Set the Users frontend group belonging
*
* @var string $userGroup
* @return void
*/
public function setUserGroup($userGroup = "") {
$this->userGroup = $userGroup;
}
/**
* Get the Staff's gender
*
* @return integer The Staff's gender
*/
public function getGender() {
return $this->gender;
}
/**
* Set the Users gender
*
* @var integer $gender
* @return void
*/
public function setGender($gender = "") {
$this->gender = $gender;
}
/**
* Get the Staff's Disabled status
*
* @return integer The frontendUser Disabled Status
*/
public function getDisabled() {
return $this->disabled;
}
/**
* Sets thhis frontenduser diabled status
*
* @param integer $disabled The frontenduser Disabled status
* @return void
*/
public function setDisabled($disabled) {
$this->disabled = $disabled;
}
/**
* Get the Staff's Deleted status
*
* @return boolean The frontendUser Deleted Status
*/
public function getDeleted() {
return $this->deleted;
}
/**
* Sets thhis frontenduser deleted status
*
* @param boolean $deleted The frontenduser Deleted status
* @return void
*/
public function setDeleted($deleted) {
$this->deleted = $deleted;
}
/**
* Get tx_wecstaffdirectory_in
*
* @return boolean tx_wecstaffdirectory_in
*/
public function getTx_wecstaffdirectory_in() {
return $this->tx_wecstaffdirectory_in;
}
/**
* set tx_wecstaffdirectory_in
*
* @param boolean $tx_wecstaffdirectory_in
* @return void
*/
public function setTx_wecstaffdirectory_in($tx_wecstaffdirectory_in) {
$this->tx_wecstaffdirectory_in = $tx_wecstaffdirectory_in;
}
}
?>
@pumatertion
Copy link

/**
* @var int
* @Orm\Id
* @Orm\Column(columnDefinition="INT(11) NOT NULL AUTO_INCREMENT UNIQUE")
* @Orm\GeneratedValue
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment