public function getSingleton() { if (!self::$singleton) { if (!(self::$singleton = $this->createQuery("r")->fetchOne())) { $scrips = new Scripts(); $scrips->save(); self::$singleton = $scrips; } } return self::$singleton; }