mysidia-advanced-adoptable

Created Diff never expires
6 removals
20 lines
4 additions
18 lines
public function getBabySpecies(){
public function getBabySpecies(){
$mysidia = Registry::get("mysidia");
$mysidia = Registry::get("mysidia");
$female = $this->female->getType();
$female = $this->female->getSpeciesID();
$male = $this->male->getType();
$male = $this->male->getSpeciesID();
$parentList = "{$female}, {$male}";
$parentList2 = "{$male}, {$female}";


$stmt = $mysidia->db->join("adoptables", "adoptables.id = breeding.offspring")
$stmt = $mysidia->db->join("adoptables", "adoptables.id = breeding.offspring")
->select("breeding", [], "((mother ='{$female}' and father = '{$male}') or (mother ='{$female}' and father = '') or (mother ='' and father = '{$male}') or parent = '{$female}' or parent = '{$male}' or parent = '{$parentList}' or parent = '{$parentList2}') and level <= {$this->female->getCurrentLevel()} and available = 'yes'");
->select("breeding", [], "((mother ='{$female}' and father = '{$male}') or (mother ='{$female}' and father = '') or (mother ='' and father = '{$male}') or parent = '{$female}' or parent = '{$male}') and level <= {$this->female->getCurrentLevel()} and available = 'yes'");


if($stmt->rowCount() == 0) return;
if($stmt->rowCount() == 0) return;
else{
else{
$species = new ArrayObject;
$species = new ArrayObject;
while($dto = $stmt->fetchObject()){
while($dto = $stmt->fetchObject()){
$adopt = new BreedAdoptable($dto->bid, $dto);
$adopt = new BreedAdoptable($dto->bid, $dto);
$species->append($adopt);
$species->append($adopt);
}
}
return $species;
return $species;
}
}
}
}