コード例 #1
0
 private function generateAndPersistNewAddresses(int $count)
 {
     $qb = $this->entityManager->createQueryBuilder();
     $qb->select('MAX(address.bip32index)')->from(Address::getClassName(), 'address');
     $index = (int) $qb->getQuery()->getSingleScalarResult();
     for ($i = 0; $i < $count; $i++) {
         list($address, $index) = $this->generateNewAddress($index);
         $addressEntity = new Address($address, $index);
         $this->entityManager->persist($addressEntity);
     }
     $this->entityManager->flush();
     file_put_contents($this->newAddressesFile, true);
 }
コード例 #2
0
ファイル: Deparment.php プロジェクト: Pavel12579/yii.loc
 public function getaAddress()
 {
     return $this->hasOne(Address::className(), ['id' => 'address_id']);
 }
コード例 #3
0
 /**
  * Create new event
  * @param Client $client
  * @return Event
  */
 public function createBlankEvent(Client $client)
 {
     //dummy adresa
     $address = new Model\Entity\Address();
     $address->setName($address::DEFAULT_NAME)->setCity($address::DEFAULT_CITY)->setCrossStreet($address::DEFAULT_CROSS_STREET)->setStreet($address::DEFAULT_STREET)->setInfo($address::DEFAULT_INFO)->setZip($address::DEFAULT_ZIP)->setCountry($address::DEFAULT_COUNTRY)->setLocation(new \Knp\DoctrineBehaviors\ORM\Geocodable\Type\Point(50.087689, 14.4211866));
     //Staromak
     //dummy čas
     $interval = new Model\Entity\DateInterval();
     $interval->setFrom(Nette\Utils\DateTime::from(time()))->setTo(Nette\Utils\DateTime::from(time() + 3600));
     //1 hodina
     $event = new Event();
     $event->setName('Nová událost')->setCategory(1)->setDescription('')->setAddress($address)->setDateStart($interval->getFrom())->setDateEnd($interval->getTo())->setDatePublished(new \DateTime())->setOrganizerName($client->getName())->setOrganizerDesc($client->getDescription())->setType(Model\Entity\Event::TYPE_PUBLIC)->setEventFee(Event::DEFAULT_FEE)->setNumber('')->setActive(false);
     $this->eventDao->getEntityManager()->persist($event);
     $this->eventDao->getEntityManager()->flush();
     // ticket-86887906 YYMMDD-XXX-NNNN, kde XXX je číslo klienta a NNNN číslo eventu
     $event->setNumber(sprintf('%s-%03d-%04d', date('ymd'), $client->id, $event->id))->setClient($client);
     $this->eventDao->getEntityManager()->persist($event);
     $this->eventDao->getEntityManager()->flush();
     return $event;
 }
コード例 #4
0
 public function renderOrder(string $genreId)
 {
     $this->template->amount = $this->pricePerGenre;
     $this->template->address = $this->address->getAddress();
 }