コード例 #1
0
 public function __construct(ClassMap $fromClassMap, $name)
 {
     $this->manager = \Maestro\Persistence\PersistentManager::getInstance();
     $this->fromClassMap = $fromClassMap;
     $this->fromClassName = $fromClassMap->getName();
     $this->name = $name;
     $this->inverse = FALSE;
 }
コード例 #2
0
 private function __retrieveAssociation(PersistentObject $object, AssociationMap $associationMap, ClassMap $classMap)
 {
     $orderAttributes = $associationMap->getOrderAttributes();
     $criteria = $associationMap->getCriteria($orderAttributes);
     $criteriaParameters = $associationMap->getCriteriaParameters($object);
     $query = $this->processCriteriaQuery($criteria, $criteriaParameters, $classMap->getDb(), FALSE);
     mtrace('=== retrieving Associations for class ' . $classMap->getName());
     $toClassMap = $associationMap->getToClassMap();
     if ($associationMap->getCardinality() == 'oneToOne') {
         // association is a single object
         $association = $toClassMap->getObject();
         $toClassMap->retrieveObject($association, $query);
     } elseif ($associationMap->getCardinality() == 'oneToMany' || $associationMap->getCardinality() == 'manyToMany') {
         // association is an Association object
         $index = $associationMap->getIndexAttribute();
         $association = new Association($toClassMap, $index);
         $toClassMap->retrieveAssociation($association, $query);
     }
     $object->set($associationMap->getName(), $association);
 }