मुझे असंगत मैपिंग के साथ समस्या है। मेरे आवेदन में दो इकाइयां हैं - संपर्क (संपर्कों के साथ इकाई ...) और जानकारी, इस संपर्क (फोन, ईमेल, फैक्स, वेबसाइट इत्यादि) के लिए सूचनाओं के साथ संस्थाएं।मैपिंग एक दूसरे के साथ असंगत हैं
और मेरे संपर्क इकाई में मैं प्रत्येक प्रकार के लिए चर बनाया है, मैं इसे अपने आवेदन में की जरूरत है क्योंकि इस तरह से बहुत आसान है:
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactInformations;
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactPhone;
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactFax;
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactWebsite;
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactEmail;
/**
* @ORM\OneToMany(targetEntity = "RelationInformations" , mappedBy = "objectID", cascade={"persist"})
*/
protected $contactCommunicator;
और फोन के लिए उदाहरण गेटर के लिए लगता है कि:
/**
* Get contactPhone
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getContactPhone()
{
if ($this->contactPhone !== null) {
foreach ($this->contactPhone->toArray() as &$info) {
if ($info->getType() !== RelationInformations::TYPE_TELEPHONE) {
$this->contactPhone->removeElement($info);
}
}
}
return $this->contactPhone;
}
इस तरह से मुझे केवल इस फ़ंक्शन का उपयोग करके मेरी सूचनाओं से केवल फोन मिल गए हैं, इसलिए मैं जो चाहता हूं उसे प्राप्त करने के लिए अन्य स्थानों में यह बहुत आसान है।
RelationInformation निकाय:
/**
* @var integer
* @ORM\Column(name = "rnis_id" , type = "integer" , nullable = false);
* @ORM\Id
* @ORM\GeneratedValue(strategy = "AUTO")
*/
private $id;
/**
* @var integer
* @ORM\ManyToOne(targetEntity = "RelationContact" , inversedBy = "contactInformations")
* @ORM\JoinColumn(name = "rnis_object_id" , referencedColumnName="rnct_id", nullable = false);
*/
private $objectID;
/**
* @var string
* @ORM\Column(name = "rnis_value" , type = "string" , nullable = false )
*/
private $value;
/**
* @var string
* @ORM\Column(name = "rnis_type" , type = "string" , nullable = false , length = 1)
*/
private $type;
/**
* @var boolean
* @ORM\Column(name = "rnis_active" , type = "boolean" , nullable = false)
*/
private $active;
/**
* @var boolean
* @ORM\Column(name = "rnis_default" , type = "boolean" , nullable = false)
*/
private $default;
/**
* @var string
* @ORM\Column(name = "rnis_txt" , type = "string" , nullable = true)
*/
private $txt;
/**
* @var integer
* @ORM\Column(name = "rnis_type_private_business" , type = "integer" , nullable = true)
*/
private $typePrivateBusiness;
समस्या यह है कि मेरी प्रोफाइलर में मैं bellow तरह त्रुटियों को देखने के कर सकते हैं। एप्लिकेशन सही तरीके से काम करता है लेकिन मैं इस मुद्दे को हल करना चाहता हूं।
The mappings RelationContact#contactPhone and RelationInformations#objectID are inconsistent with each other.
The mappings RelationContact#contactFax and RelationInformations#objectID are inconsistent with each other.
The mappings RelationContact#contactWebsite and RelationInformations#objectID are inconsistent with each other.
The mappings RelationContact#contactEmail and RelationInformations#objectID are inconsistent with each other.
The mappings RelationContact#contactCommunicator and RelationInformations#objectID are inconsistent with each other.
The mappings RelationContact#contactBrand and RelationInformations#objectID are inconsistent with each other.
इकाई 'RelationInformations' – Matteo
ठीक है का कोड पोस्ट करें, मैं इसे जोड़ने के लिए;) –