public function getByFile($file) { foreach ($this->datas as $unit) { if ($unit->getFile() == $file) { return $unit; } } return null; }