protected function getRandomId(dmDoctrineTable $table) { $id = $table->createQuery('t')->select('t.id, RANDOM() AS rand')->orderBy('rand')->limit(1)->fetchValue(); if (!$id) { $recordLoremizer = new self($this->getOptions()); $id = $recordLoremizer->execute($table->create())->saveGet()->get('id'); } return $id; }