public function getByProduct($product) { $this->db->select(); $this->db->from('thing'); $this->db->where('thing_id', $product->getThing()->getId()); $query = $this->db->get(); $thingOptions = array(); foreach ($query->result() as $row) { $thingOptions[] = Thing::loadFromRow($row); } //get options $options = array(); foreach ($thingOptions as $thingOptions) { $options[] = Option::load($thingOptions); } return $options; }
public function getChildThings($thingName) { $this->db->select(); $this->db->from('thing'); $this->db->where('name', $thingName); $this->db->where('thing_id', $this->getId()); $query = $this->db->get(); $children = array(); foreach ($query->result() as $row) { $children[] = Thing::loadFromRow($row); } return $children; }