Exemplo n.º 1
0
 /**
  * @param string $token
  *
  * @return bool
  */
 protected function isField($token)
 {
     $availableFields = $this->metaDataProvider->getAvailableFields();
     foreach ($availableFields as $field) {
         if ($field === $token) {
             return true;
         }
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * @param \Generated\Shared\Transfer\ClauseTransfer $clauseTransfer
  *
  * @throws \Spryker\Zed\Discount\Business\Exception\QueryStringException
  *
  * @return void
  */
 protected function validateIfFieldIsRegistered(ClauseTransfer $clauseTransfer)
 {
     $clauseField = $clauseTransfer->getField();
     if ($clauseTransfer->getAttribute()) {
         $clauseField = $clauseField . '.' . $clauseTransfer->getAttribute();
     }
     foreach ($this->metaDataProvider->getAvailableFields() as $field) {
         if ($field === $clauseField) {
             return;
         }
     }
     throw new QueryStringException(sprintf('Could not found for field with name "%s".', $clauseTransfer->getField()));
 }