/** * @param Clubs $club * @return LicencesTeams */ public function getNewLicences(Clubs $club) { $em = $this->em; //create empty entity licence $licence = new LicencesTeams(); $em->persist($licence); $em->flush(); //set data to create licence $idLicence = str_pad($licence->getId(), 5, 0, STR_PAD_LEFT); $idClub = str_pad($club->getId(), 3, 0, STR_PAD_LEFT); $jd = $this->getJulianDate('now'); // cretae number licence and flush it $licence->setLicence(self::PREFIX_LICENCE . $idClub . $idLicence . $jd); $em->persist($licence); $em->flush(); return $licence; }
/** * @return array */ public function toArray() { return ['weezevent_api_log_id' => $this->getId(), 'user_id' => $this->getUser() ? $this->getUser()->getId() : null, 'api_username' => $this->apiUsername, 'api_password' => $this->apiPassword, 'api_key' => $this->getApiKey(), 'date_register' => $this->getDateRegister()->format('Y-m-d H:i:s'), 'club_id' => $this->club ? $this->club->getId() : null]; }