0
두 개의 엔티티 양식이 '주문'및 '주소'로 있습니다. 주소 양식을 주문 양식에 삽입하고 싶습니다. 두 엔티티 모두 사용자 열에 의해 관계가 있습니다.하나의 양식을 다른 symfony2에 포함하십시오
주소 엔티티
class Address
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=128)
*/
protected $type;
/**
* @ORM\ManyToOne(targetEntity="Root\UserBundle\Entity\User", inversedBy="address")
* @ORM\JoinColumn(name="user", referencedColumnName="id")
* @ORM\ManyToOne(targetEntity="Orders", inversedBy="address")
* @ORM\JoinColumn(name="user", referencedColumnName="user")
*/
protected $user;
주문 엔티티
class Orders
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=128)
*/
protected $status;
/**
* @ORM\ManyToOne(targetEntity="Root\UserBundle\Entity\User", inversedBy="orders")
* @ORM\JoinColumn(name="user", referencedColumnName="id")
* @ORM\OneToMany(targetEntity="Address", mappedBy="orders")
* @ORM\JoinColumn(name="user", referencedColumnName="user")
*/
protected $user;
주문 양식
namespace Root\ContestBundle\Form\Front;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Root\ContestBundle\Entity\Address;
use Root\ContestBundle\Form\Front\AddressType;
class OrdersType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('address', 'collection', array('type' => new AddressType()));
$builder
->add('termsAccepted');
}
그러나 나는 getti 오전 오류가 아래와 같습니다.
An exception has been thrown during the rendering of a template ("Neither property "address" nor method "getAddress()" nor method "isAddress()" exists in class "Root\ContestBundle\Entity\Orders"")
그래서 내 코드에서 어떤 실수를 했습니까? 도와주세요