Example #1
0
 /**
  * @param string MetaData::ManyToOne|MetaData::OneToOne|MetaData::ManyToMany|MetaData::OneToMany
  * @param string
  * @param string
  * @param string
  * @param string
  */
 public function __construct($type, $parentEntityName, $parentParam, $childRepositoryName, $childParam)
 {
     if ($type !== MetaData::ManyToOne and $type !== MetaData::OneToOne) {
         throw new InvalidArgumentException();
     }
     if (!$childRepositoryName) {
         throw new RelationshipLoaderException("{$parentEntityName}::\${$parentParam} {{$type}} You must specify foreign repository {{$type} repositoryName}");
     }
     parent::__construct($type, $parentEntityName, $parentParam, $childRepositoryName, $childParam);
 }
 /**
  * @param RelationshipMetaData
  * @param RelationshipMetaData
  */
 protected function checkIntegrityCallback(RelationshipMetaData $parent, RelationshipMetaData $child)
 {
     if ($parent === $child) {
         $parent->mapped = self::MAPPED_BOTH;
     } else {
         $pm = $parent->getWhereIsMapped();
         $cm = $child->getWhereIsMapped();
         if ($pm === self::MAPPED_HERE and $cm === self::MAPPED_HERE) {
             throw new RelationshipLoaderException("{$parent->parentEntityName}::\${$parent->parentParam} a {$child->parentEntityName}::\${$parent->childParam} {{$parent->type}} u ubou je nastaveno ze se na jeho strane ma mapovat, je potreba vybrat a mapovat jen podle jedne strany");
         }
         if ($pm === self::MAPPED_THERE and $cm === self::MAPPED_THERE) {
             throw new RelationshipLoaderException("{$parent->parentEntityName}::\${$parent->parentParam} a {$child->parentEntityName}::\${$parent->childParam} {{$parent->type}} ani u jednoho neni nastaveno ze se podle neho ma mapovat. napÅ™: {m:m {$parent->repository} {$parent->childParam} mapped}");
         }
     }
 }