src/wcmf/lib/model/mapper/impl/NodeUnifiedRDBMapper.php
protected function loadRelationObjects(PersistentObjectProxy $objectProxy,
          PersistentObjectProxy $relativeProxy, RDBManyToManyRelationDescription $relationDesc,
          $includeTransaction=false) {
    $nmMapper = self::getMapper($relationDesc->getThisEndRelation()->getOtherType());
    $nmType = $nmMapper->getType();

    $thisId = $objectProxy->getOID()->getFirstId();
    $otherId = $relativeProxy->getOID()->getFirstId();
    $thisEndRelation = $relationDesc->getThisEndRelation();
    $otherEndRelation = $relationDesc->getOtherEndRelation();
    $thisFkAttr = $nmMapper->getAttribute($thisEndRelation->getFkName());
    $otherFkAttr = $nmMapper->getAttribute($otherEndRelation->getFkName());

    $criteria1 = new Criteria($nmType, $thisFkAttr->getName(), "=", $thisId);
    $criteria2 = new Criteria($nmType, $otherFkAttr->getName(), "=", $otherId);
    $criteria = [$criteria1, $criteria2];
    $nmObjects = $nmMapper->loadObjects($nmType, BuildDepth::SINGLE, $criteria);

    if ($includeTransaction) {
      $transaction = $this->persistenceFacade->getTransaction();
      $objects = $transaction->getObjects();
      foreach ($objects as $object) {
        if ($object->getType() == $nmType && $object instanceof Node) {
          // we expect single valued relation ends
          $thisEndObject = $object->getValue($thisEndRelation->getThisRole());
          $otherEndObject = $object->getValue($otherEndRelation->getOtherRole());
          if ($objectProxy->getOID() == $thisEndObject->getOID() &&
                  $relativeProxy->getOID() == $otherEndObject->getOID()) {
            $nmObjects[] = $object;
          }
        }
      }
    }
    return $nmObjects;
  }
protected function loadRelationObjects(PersistentObjectProxy $objectProxy,
          PersistentObjectProxy $relativeProxy, RDBManyToManyRelationDescription $relationDesc,
          $includeTransaction=false) {
    $nmMapper = self::getMapper($relationDesc->getThisEndRelation()->getOtherType());
    $nmType = $nmMapper->getType();

    $thisId = $objectProxy->getOID()->getFirstId();
    $otherId = $relativeProxy->getOID()->getFirstId();
    $thisEndRelation = $relationDesc->getThisEndRelation();
    $otherEndRelation = $relationDesc->getOtherEndRelation();
    $thisFkAttr = $nmMapper->getAttribute($thisEndRelation->getFkName());
    $otherFkAttr = $nmMapper->getAttribute($otherEndRelation->getFkName());

    $criteria1 = new Criteria($nmType, $thisFkAttr->getName(), "=", $thisId);
    $criteria2 = new Criteria($nmType, $otherFkAttr->getName(), "=", $otherId);
    $criteria = [$criteria1, $criteria2];
    $nmObjects = $nmMapper->loadObjects($nmType, BuildDepth::SINGLE, $criteria);

    if ($includeTransaction) {
      $transaction = $this->persistenceFacade->getTransaction();
      $objects = $transaction->getObjects();
      foreach ($objects as $object) {
        if ($object->getType() == $nmType && $object instanceof Node) {
          // we expect single valued relation ends
          $thisEndObject = $object->getValue($thisEndRelation->getThisRole());
          $otherEndObject = $object->getValue($otherEndRelation->getOtherRole());
          if ($objectProxy->getOID() == $thisEndObject->getOID() &&
                  $relativeProxy->getOID() == $otherEndObject->getOID()) {
            $nmObjects[] = $object;
          }
        }
      }
    }
    return $nmObjects;
  }
protected function loadRelationObjects ( PersistentObjectProxy $ objectProxy , PersistentObjectProxy $ relativeProxy , RDBManyToManyRelationDescription $ relationDesc , $ includeTransaction = false ) { $ nmMapper = self :: getMapper ( $ relationDesc -> getThisEndRelation ( ) -> getOtherType ( ) ) ; $ nmType = $ nmMapper -> getType ( ) ; $ thisId = $ objectProxy -> getOID ( ) -> getFirstId ( ) ; $ otherId = $ relativeProxy -> getOID ( ) -> getFirstId ( ) ; $ thisEndRelation = $ relationDesc -> getThisEndRelation ( ) ; $ otherEndRelation = $ relationDesc -> getOtherEndRelation ( ) ; $ thisFkAttr = $ nmMapper -> getAttribute ( $ thisEndRelation -> getFkName ( ) ) ; $ otherFkAttr = $ nmMapper -> getAttribute ( $ otherEndRelation -> getFkName ( ) ) ; $ criteria1 = new Criteria ( $ nmType , $ thisFkAttr -> getName ( ) , "=" , $ thisId ) ; $ criteria2 = new Criteria ( $ nmType , $ otherFkAttr -> getName ( ) , "=" , $ otherId ) ; $ criteria = [ $ criteria1 , $ criteria2 ] ; $ nmObjects = $ nmMapper -> loadObjects ( $ nmType , BuildDepth :: SINGLE , $ criteria ) ; if ( $ includeTransaction ) { $ transaction = $ this -> persistenceFacade -> getTransaction ( ) ; $ objects = $ transaction -> getObjects ( ) ; foreach ( $ objects as $ object ) { if ( $ object -> getType ( ) == $ nmType && $ object instanceof Node ) { // we expect single valued relation ends $ thisEndObject = $ object -> getValue ( $ thisEndRelation -> getThisRole ( ) ) ; $ otherEndObject = $ object -> getValue ( $ otherEndRelation -> getOtherRole ( ) ) ; if ( $ objectProxy -> getOID ( ) == $ thisEndObject -> getOID ( ) && $ relativeProxy -> getOID ( ) == $ otherEndObject -> getOID ( ) ) { $ nmObjects [ ] = $ object ; } } } } return $ nmObjects ; }
Load the relation objects in a many to many relation from the database.
@param $objectProxy The proxy at this end of the relation.
@param $relativeProxy The proxy at the other end of the relation.
@param $relationDesc The RDBManyToManyRelationDescription instance describing the relation.
@param $includeTransaction Boolean whether to also search in the current transaction (default: false)
@return Array of PersistentObject instances
Load the relation objects in a many to many relation from the database .