예제 #1
0
파일: RateTable.php 프로젝트: spryker/Tax
 /**
  * @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config
  *
  * @return array
  */
 protected function prepareData(TableConfiguration $config)
 {
     $result = [];
     $query = $this->taxRateQuery->leftJoinCountry(SpyCountryTableMap::TABLE_NAME);
     $queryResult = $this->runQuery($query, $config, true);
     /** @var \Orm\Zed\Tax\Persistence\SpyTaxRate $taxRateEntity */
     foreach ($queryResult as $taxRateEntity) {
         $result[] = [SpyTaxRateTableMap::COL_ID_TAX_RATE => $taxRateEntity->getIdTaxRate(), SpyTaxRateTableMap::COL_CREATED_AT => $this->dateFormatter->dateTime($taxRateEntity->getCreatedAt()), SpyTaxRateTableMap::COL_NAME => $taxRateEntity->getName(), SpyCountryTableMap::COL_NAME => $this->getCountryName($taxRateEntity), SpyTaxRateTableMap::COL_RATE => $taxRateEntity->getRate(), self::TABLE_COL_ACTIONS => $this->getActionButtons($taxRateEntity)];
     }
     return $result;
 }
예제 #2
0
 /**
  * @return \Orm\Zed\Tax\Persistence\SpyTaxSetQuery
  */
 public function createTaxSetQuery()
 {
     return SpyTaxSetQuery::create();
 }
예제 #3
0
파일: WriterTest.php 프로젝트: spryker/Tax
 /**
  * @return void
  */
 public function testDeleteTaxSetShouldDeleteSetButNotTheAssociatedRate()
 {
     $taxRateTransfer = $this->createTaxRateTransfer();
     $rateId = $this->taxFacade->createTaxRate($taxRateTransfer)->getIdTaxRate();
     $taxRateTransfer->setIdTaxRate($rateId);
     $taxRateQuery = SpyTaxRateQuery::create()->filterByIdTaxRate($rateId);
     $taxRateEntity = $taxRateQuery->findOne();
     $this->assertNotEmpty($taxRateEntity);
     $taxSetTransfer = $this->createTaxSetTransfer();
     $taxSetTransfer->addTaxRate($taxRateTransfer);
     $setId = $this->taxFacade->createTaxSet($taxSetTransfer)->getIdTaxSet();
     $taxSetQuery = SpyTaxSetQuery::create()->filterByIdTaxSet($setId);
     $taxSetEntity = $taxSetQuery->findOne();
     $this->assertNotEmpty($taxSetEntity);
     $this->taxFacade->deleteTaxSet($setId);
     $taxRateEntity = $taxRateQuery->findOne();
     $this->assertNotEmpty($taxRateEntity);
     $taxSetEntity = $taxSetQuery->findOne();
     $this->assertEmpty($taxSetEntity);
 }