php app/console doctrine:generate:entities DigitalManager
<?php
namespace DigitalManager\Bundle\ERPBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Party
*
* @ORM\Table(name="party")
* @ORM\Entity
*/
class Party
{
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=45, nullable=true)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity="Account", inversedBy="parties")
* @ORM\JoinColumn(name="account_id", referencedColumnName="aid")
*/
public $account;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=45, nullable=true)
*/
private $address;
/**
* @var string
*
* @ORM\Column(name="phone_fax", type="string", length=45, nullable=true)
*/
private $phoneFax;
/**
* @var string
*
* @ORM\Column(name="fax", type="string", length=45, nullable=true)
*/
private $fax;
/**
* @var string
*
* @ORM\Column(name="email", type="string", length=45, nullable=true)
*/
private $email;
/**
* @var string
*
* @ORM\Column(name="mobile", type="string", length=45, nullable=true)
*/
private $mobile;
/**
* @var string
*
* @ORM\Column(name="country", type="string", length=45, nullable=true)
*/
private $country;
/**
* @var string
*
* @ORM\Column(name="city", type="string", length=45, nullable=true)
*/
private $city;
/**
* @var string
*
* @ORM\Column(name="phone_res", type="string", length=45, nullable=true)
*/
private $phoneRes;
/**
* @var string
*
* @ORM\Column(name="remarks", type="string", length=45, nullable=true)
*/
private $remarks;
/**
* @var boolean
*
* @ORM\Column(name="active", type="boolean", nullable=true)
*/
private $active;
/**
* @var integer
*
* @ORM\Column(name="limit", type="integer", nullable=true)
*/
private $limit;
/**
* @var integer
*
* @ORM\Column(name="term", type="integer", nullable=true)
*/
private $term;
/**
* @var string
*
* @ORM\Column(name="officer_id", type="string", length=45, nullable=true)
*/
private $officerId;
/**
* @var \DateTime
*
* @ORM\Column(name="date", type="datetime", nullable=true)
*/
private $date;
/**
* @var string
*
* @ORM\Column(name="cnic", type="string", length=45, nullable=true)
*/
private $cnic;
/**
* @var string
*
* @ORM\Column(name="ntn", type="string", length=45, nullable=true)
*/
private $ntn;
/**
* @var boolean
*
* @ORM\Column(name="L_O", type="boolean", nullable=true)
*/
private $lO;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=45, nullable=true)
*/
private $type;
/**
* @var integer
*
* @ORM\Column(name="acc_id", type="integer", nullable=true)
*/
private $accId;
/**
* @var integer
*
* @ORM\Column(name="party_id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $partyId;
/**
* Set name
*
* @param string $name
* @return Party
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set address
*
* @param string $address
* @return Party
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set phoneFax
*
* @param string $phoneFax
* @return Party
*/
public function setPhoneFax($phoneFax)
{
$this->phoneFax = $phoneFax;
return $this;
}
/**
* Get phoneFax
*
* @return string
*/
public function getPhoneFax()
{
return $this->phoneFax;
}
/**
* Set fax
*
* @param string $fax
* @return Party
*/
public function setFax($fax)
{
$this->fax = $fax;
return $this;
}
/**
* Get fax
*
* @return string
*/
public function getFax()
{
return $this->fax;
}
/**
* Set email
*
* @param string $email
* @return Party
*/
public function setEmail($email)
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail()
{
return $this->email;
}
/**
* Set mobile
*
* @param string $mobile
* @return Party
*/
public function setMobile($mobile)
{
$this->mobile = $mobile;
return $this;
}
/**
* Get mobile
*
* @return string
*/
public function getMobile()
{
return $this->mobile;
}
/**
* Set country
*
* @param string $country
* @return Party
*/
public function setCountry($country)
{
$this->country = $country;
return $this;
}
/**
* Get country
*
* @return string
*/
public function getCountry()
{
return $this->country;
}
/**
* Set city
*
* @param string $city
* @return Party
*/
public function setCity($city)
{
$this->city = $city;
return $this;
}
/**
* Get city
*
* @return string
*/
public function getCity()
{
return $this->city;
}
/**
* Set phoneRes
*
* @param string $phoneRes
* @return Party
*/
public function setPhoneRes($phoneRes)
{
$this->phoneRes = $phoneRes;
return $this;
}
/**
* Get phoneRes
*
* @return string
*/
public function getPhoneRes()
{
return $this->phoneRes;
}
/**
* Set remarks
*
* @param string $remarks
* @return Party
*/
public function setRemarks($remarks)
{
$this->remarks = $remarks;
return $this;
}
/**
* Get remarks
*
* @return string
*/
public function getRemarks()
{
return $this->remarks;
}
/**
* Set active
*
* @param boolean $active
* @return Party
*/
public function setActive($active)
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set limit
*
* @param integer $limit
* @return Party
*/
public function setLimit($limit)
{
$this->limit = $limit;
return $this;
}
/**
* Get limit
*
* @return integer
*/
public function getLimit()
{
return $this->limit;
}
/**
* Set term
*
* @param integer $term
* @return Party
*/
public function setTerm($term)
{
$this->term = $term;
return $this;
}
/**
* Get term
*
* @return integer
*/
public function getTerm()
{
return $this->term;
}
/**
* Set officerId
*
* @param string $officerId
* @return Party
*/
public function setOfficerId($officerId)
{
$this->officerId = $officerId;
return $this;
}
/**
* Get officerId
*
* @return string
*/
public function getOfficerId()
{
return $this->officerId;
}
/**
* Set date
*
* @param \DateTime $date
* @return Party
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set cnic
*
* @param string $cnic
* @return Party
*/
public function setCnic($cnic)
{
$this->cnic = $cnic;
return $this;
}
/**
* Get cnic
*
* @return string
*/
public function getCnic()
{
return $this->cnic;
}
/**
* Set ntn
*
* @param string $ntn
* @return Party
*/
public function setNtn($ntn)
{
$this->ntn = $ntn;
return $this;
}
/**
* Get ntn
*
* @return string
*/
public function getNtn()
{
return $this->ntn;
}
/**
* Set lO
*
* @param boolean $lO
* @return Party
*/
public function setLO($lO)
{
$this->lO = $lO;
return $this;
}
/**
* Get lO
*
* @return boolean
*/
public function getLO()
{
return $this->lO;
}
/**
* Set type
*
* @param string $type
* @return Party
*/
public function setType($type)
{
$this->type = $type;
return $this;
}
/**
* Get type
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Set accId
*
* @param integer $accId
* @return Party
*/
public function setAccId($accId)
{
$this->accId = $accId;
return $this;
}
/**
* Get accId
*
* @return integer
*/
public function getAccId()
{
return $this->accId;
}
/**
* Get partyId
*
* @return integer
*/
public function getPartyId()
{
return $this->partyId;
}
}
<?php
namespace DigitalManager\Bundle\ERPBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* Account
*
* @ORM\Table(name="account")
* @ORM\Entity
*/
class Account
{
public function __construct()
{
parent::__construct();
// The line below must be here as a single category is to be mapped to many products, so an ArrayCollection is required instead of Array.
$this->parties = new ArrayCollection();
}
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=45, nullable=true)
*/
private $name;
// The metadata above the $products property of the Category object is less important, and simply tells
// Doctrine to look at the Product.category property to figure out how the relationship is mapped.
/**
* @ORM\OneToMany(targetEntity="Party", mappedBy="account")
*/
protected $parties;
/**
* @var string
*
* @ORM\Column(name="address", type="string", length=200, nullable=true)
*/
private $address;
/**
* @var string
*
* @ORM\Column(name="level1", type="string", length=45, nullable=true)
*/
private $level1;
/**
* @var string
*
* @ORM\Column(name="level2", type="string", length=45, nullable=true)
*/
private $level2;
/**
* @var string
*
* @ORM\Column(name="level3", type="string", length=45, nullable=true)
*/
private $level3;
/**
* @var string
*
* @ORM\Column(name="contact", type="string", length=45, nullable=true)
*/
private $contact;
/**
* @var integer
*
* @ORM\Column(name="aid", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*/
private $aid;
/**
* Set name
*
* @param string $name
* @return Account
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set address
*
* @param string $address
* @return Account
*/
public function setAddress($address)
{
$this->address = $address;
return $this;
}
/**
* Get address
*
* @return string
*/
public function getAddress()
{
return $this->address;
}
/**
* Set level1
*
* @param string $level1
* @return Account
*/
public function setLevel1($level1)
{
$this->level1 = $level1;
return $this;
}
/**
* Get level1
*
* @return string
*/
public function getLevel1()
{
return $this->level1;
}
/**
* Set level2
*
* @param string $level2
* @return Account
*/
public function setLevel2($level2)
{
$this->level2 = $level2;
return $this;
}
/**
* Get level2
*
* @return string
*/
public function getLevel2()
{
return $this->level2;
}
/**
* Set level3
*
* @param string $level3
* @return Account
*/
public function setLevel3($level3)
{
$this->level3 = $level3;
return $this;
}
/**
* Get level3
*
* @return string
*/
public function getLevel3()
{
return $this->level3;
}
/**
* Set contact
*
* @param string $contact
* @return Account
*/
public function setContact($contact)
{
$this->contact = $contact;
return $this;
}
/**
* Get contact
*
* @return string
*/
public function getContact()
{
return $this->contact;
}
/**
* Get aid
*
* @return integer
*/
public function getAid()
{
return $this->aid;
}
}
有两个过程来生成一个实体和创建一个数据库等过程。
我想你可以这样做
1. create a entity using command
php app/console doctrine:generate:entity
you provide shortcut name Like AcmeHelloBundle. After that it will ask you all the filed name of a table. step by step you create the table.
2. If you not create your database then set database configuration file and run this command
php app/console doctrine:database:create
3. After create the database you need to create the table depending on your entity that create in list 2 and run the folloing command like
php app/console doctrine:schema:update --force
4.Now you can create association with other entity. I just show here create entity but you need to create all entity that need for your project. After perfect association you need to run this command
php app/console doctrine:generate:entities DigitalManager
5. Finnaly you need to perform this command again
php app/console doctrine:schema:update --force
这可能行得通。
菜单栏: Code —> Generate —> Getter and Setter Mac: command + N Windows\/Linux: Alt + Insert —> Getter and Setter
当你在Java的时候你可以按 ALT插入-- 在旧版本的Intellij中,我记得当我创建“getter and setter”时,它是在光标位于按下Alt的那一刻创建的。但现在,它们是在为其创建“getter和setter”的字段下创建的。 如何更改此行为,以便在按下Alt/kbd>Insert的那一刻在光标所在的位置创建getter和setter?
我在为Lombok getter和setter生成Javadoc时遇到问题。这两个建议我都试过了。示例字段及其文本如下所示: 但是,我在生成的Javadoc中既没有看到getter,也没有看到setter。我在Eclipse上使用受保护的可见性(项目-
我只是试图将一个基于Maven的项目发送到另一台计算机上,而可怕的是,到处都是红色标记!! 但是,构建得很好。 很快,我注意到Lombok没有为我的类生成getter和setter,尽管和被Eclipse正确识别。
我想知道为什么我的映射器由映射结构生成的映射器不是用获取器和设置器生成的。 我认为正因为如此,当我去对邮递员发出GET请求时,它会返回所有不应该返回空值的空值。 我使用专家,java 8和Spring启动 pom.xml文件: 映射器: 实体DTO: 实体: 映射器实现: 如果有人知道怎么解决,请帮忙。谢谢;)