Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 664 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 664 Rev 7328
Línea 7... Línea 7...
7
use LeadersLinked\Model\Location;
7
use LeadersLinked\Model\Location;
8
use LeadersLinked\Mapper\Common\MapperCommon;
8
use LeadersLinked\Mapper\Common\MapperCommon;
9
use Laminas\Db\Adapter\AdapterInterface;
9
use Laminas\Db\Adapter\AdapterInterface;
10
use Laminas\Log\LoggerInterface;
10
use Laminas\Log\LoggerInterface;
11
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
11
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
-
 
12
use Laminas\Db\Sql\Expression;
Línea 12... Línea 13...
12
 
13
 
13
 
14
 
14
class LocationMapper extends MapperCommon
15
class LocationMapper extends MapperCommon
Línea 83... Línea 84...
83
        $select->where->equalTo('uuid', $uuid);
84
        $select->where->equalTo('uuid', $uuid);
Línea 84... Línea 85...
84
        
85
        
85
        return $this->executeFetchOneObject($select, $prototype);
86
        return $this->executeFetchOneObject($select, $prototype);
Línea -... Línea 87...
-
 
87
    }
-
 
88
    
-
 
89
    
-
 
90
    
-
 
91
    
-
 
92
    /**
-
 
93
     *
-
 
94
     * @param int $company_id
-
 
95
     * @param double $latitude
-
 
96
     * @param double $longitude
-
 
97
     * @return int[]
-
 
98
     */
-
 
99
    public function fetchAllUserIdsByCompanyId($company_id, $latitude, $longitude)
-
 
100
    {
-
 
101
        
-
 
102
        
-
 
103
        $select = $this->sql->select();
-
 
104
        $select->columns(['user_id' => new Expression('DISTINCT(tb1.user_id)')]);
-
 
105
        $select->from(['tb1' => CompanyUserMapper::_TABLE]);
-
 
106
        $select->join(['tb2' => UserProfileMapper::_TABLE], 'tb1.user_id = tb2.user_id', []);
-
 
107
        $select->join(['tb3' => self::_TABLE], 'tb2.location_id  = tb3.id', []);
-
 
108
        $select->where->equalTo('tb1.company_id', $company_id);
-
 
109
        $select->where->equalTo('tb3.latitude', $latitude);
-
 
110
        $select->where->equalTo('tb3.longitude', $longitude);
-
 
111
        $select->where->isNotNull('tb2.location_id');
-
 
112
        
-
 
113
        $ids = [];
-
 
114
        $records = $this->executeFetchAllArray($select);
-
 
115
        foreach($records as $record)
-
 
116
        {
-
 
117
            array_push($ids, $record['user_id']);
-
 
118
        }
-
 
119
        
-
 
120
        return $ids;
-
 
121
    }
86
    }
122
    
87
    
123
    
88
    /**
124
    /**
89
     * 
125
     * 
90
     * @param Location $location
126
     * @param Location $location