public function __construct() { $this->id = KeyGenerator::generate(8); $this->ownerId = $this->id . KeyGenerator::generate(4); $this->createdAt = new \DateTime(); }
/** * Generate a new ID - don't use once the player is saved * * @return null **/ protected function generateId() { if (null !== $this->id) { throw new \LogicException('Can not change the id of a saved player'); } $this->id = KeyGenerator::generate(4); }