「Php/Symfony/Symfony2/doctrine/crud」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==dbに合わせたcontrollerを作成する(crud)== $ php app/console doctrine:generate:entity --entity="AcmeHelloBundle:Blog" --fields="name:string(255) description:te...」) |
(→dbに合わせたcontrollerを作成する(crud)) |
||
行51: | 行51: | ||
{ | { | ||
$this->name = $name; | $this->name = $name; | ||
− | |||
return $this; | return $this; | ||
} | } | ||
行72: | 行71: | ||
{ | { | ||
$this->description = $description; | $this->description = $description; | ||
− | |||
return $this; | return $this; | ||
} | } |
2017年1月16日 (月) 23:28時点における版
dbに合わせたcontrollerを作成する(crud)
$ php app/console doctrine:generate:entity --entity="AcmeHelloBundle:Blog" --fields="name:string(255) description:text"
src/Acme/HelloBundle/Entity/Blog.php
namespace Acme\HelloBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Blog * * @ORM\Table("blogs") * @ORM\Entity */ class Blog { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="name", type="string", length=255) */ private $name; /** * @var string * * @ORM\Column(name="description", type="text") */ private $description; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name * @return Blog */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set description * * @param string $description * @return Blog */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description * * @return string */ public function getDescription() { return $this->description; } }