私はsymfony2を初めて使用します。ポートフォリオコントローラーと呼ばれる基本的なコントローラーと、このコントローラーのインデックスビューを作成しました。Entityクラスも作成しましたが、エラーが発生します。
私のコントローラーは
<?php
namespace IDP\Bundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class PortfolioController extends Controller {
public function indexAction() {
$product = $this->getDoctrine()
->getRepository('IDPBundle:Portfolio')
->find(1);
return $this->render('IDPBundle:Portfolio:index.html.twig');
}
}
src / IDP / Bundle / Entity/Portfolio.php内
<?php
namespace IDP\Bundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
class Portfolio
{
private $id;
private $user_id;
private $portfolio_name;
private $description;
private $permalink;
private $sharingCode;
private $shared;
private $shared_portfolio_calls;
private $patentgroup_id;
public function __construct()
{
$this->portfolioGroups = new \Doctrine\Common\Collections\ArrayCollection();
}
public function getId()
{
return $this->id;
}
public function setName($portfolio_name)
{
$this->name = $portfolio_name;
}
public function setDescription($description)
{
$this->description = $description;
}
public function getDescription()
{
return $this->description;
}
public function setSharingCode($sharingCode)
{
$this->sharingCode = $sharingCode;
}
public function getSharingCode()
{
return $this->sharingCode;
}
public function setShared($shared)
{
$this->shared = $shared;
}
public function getShared()
{
return $this->shared;
}
public function getUser()
{
return $this->user;
}
}
私のテーブル名はpm_portfoliosで、ポートフォリオクラスで言及したすべてのフィールドが含まれています。
誰かが私が間違っていることを教えてもらえますか?