function assebmleSet(array $tuples, FetchStrategy $fetchStrategy)
 {
     $objects = array();
     $dao = $this->container->getDao();
     foreach ($tuples as $tuple) {
         try {
             $id = $this->fkType->assemble($tuple, $fetchStrategy);
         } catch (OrmModelIntegrityException $e) {
             if (!$this->isNullable()) {
                 throw new OrmModelIntegrityException('cannot be null');
             }
             $id = null;
         }
         $objects[] = $id ? $dao->getLazyEntityById($id) : null;
     }
     if (empty($objects)) {
         return array();
     }
     if ($fetchStrategy->is(FetchStrategy::CASCADE)) {
         // fetch them all
         $idsToFetch = array();
         foreach ($objects as $object) {
             if ($object && !$object->isFetched()) {
                 $idsToFetch[] = $object->_getId();
             }
         }
         $dao->getByIds($idsToFetch);
     }
     return $objects;
 }
Пример #2
0
 /**
  * Gets the value of the entity's property. The value is obtained according to the current
  * setting of EntityQuery and the FetchStrategy set inside DAO of the entity
  * @param string name of the property
  * @return scalar
  */
 function getProperty($property)
 {
     return $this->entity->getDao()->getProperty($this->makeSelect(Projection::property($property)));
 }