Ejemplo n.º 1
0
 /**
  * @param Tema $tema
  * @return integer[]
  */
 private function getUnusedChasti($tema)
 {
     $chasy = $tema->chasy ?: 2;
     $chastiCount = ceil($chasy / 2);
     $chasti = range(1, $chastiCount);
     $zcts = $tema->getZanyatiya_chastej_tem_rel()->joinWith('zanyatie_rel')->where($this->zanyatieIsUsedCond())->all();
     $usedChasti = ArrayHelper::getColumn($zcts, 'chast_temy', false);
     $result = array_diff($chasti, $usedChasti);
     sort($result);
     return $result;
 }