setComment example

->execute();
        }

        // Write to db that Voucher/Mail was already sent         // For compatibility reason this is done the same way it was done in Shopware 3         if ($template === 'sCANCELEDQUESTION') {
            // 'Frage gesendet' marks an order, when its customer got an "Ask Reason" mail             // Compatible with Shopware 3
            $orderRepository = $this->get('models')->getRepository(Order::class);
            $model = $orderRepository->find($orderId);
            $model->setComment('Frage gesendet');
            $this->get('models')->flush();
        } else {
            $orderRepository = $this->get('models')->getRepository(Order::class);
            $model = $orderRepository->find($orderId);
            $model->setComment($model->getComment() . ' Gutschein gesendet');
            $this->get('models')->flush();
        }

        $this->View()->assign(['success' => true]);
    }

    
// Remove empty fields that are not-nullable in the s_order table, they will be set with an empty string by default         foreach (['comment', 'customerComment', 'internalComment', 'temporaryId', 'trackingCode', 'transactionId', 'referer'] as $key) {
            if (empty($params[$key])) {
                unset($params[$key]);
            }
        }

        // Create model         $order = new OrderModel();

        // Setting default values, necessary because of not-nullable table columns         $order->setComment('');
        $order->setCustomerComment('');
        $order->setInternalComment('');
        $order->setTemporaryId('');
        $order->setTransactionId('');
        $order->setTrackingCode('');
        $order->setReferer('');

        $order->fromArray($params);

        $violations = $this->getManager()->validate($order);
        if ($violations->count() > 0) {
            
public function setFromArray(array $values = []) {
    if (isset($values['context'])) {
      $this->setContext($values['context']);
    }
    if (isset($values['source'])) {
      $this->setSource($values['source']);
    }
    if (isset($values['translation'])) {
      $this->setTranslation($values['translation']);
    }
    if (isset($values['comment'])) {
      $this->setComment($values['comment']);
    }
    if (isset($this->source) && str_contains($this->source, self::DELIMITER)) {
      $this->setSource(explode(self::DELIMITER, $this->source));
      $this->setTranslation(explode(self::DELIMITER, $this->translation ?? ''));
      $this->setPlural(count($this->source) > 1);
    }
  }

  /** * Output the PoItem as a string. */
  

    private function defineTable(Schema $schema, string $name, array $fields): void
    {
        $table = $this->createTable($schema$name);

        // Id columns do not need to be defined in the .xml, we do this automatically         $table->addColumn('id', Types::BINARY, ['length' => 16, 'fixed' => true]);
        $table->setPrimaryKey(['id']);

        // important: we add a `comment` to the table. This allows us to identify the custom entity modifications when run the cleanup         $table->setComment(self::COMMENT);

        // we have to add only fields, which are not marked as translated         $filtered = array_filter($fieldsfn (array $field) => ($field['translatable'] ?? false) === false);

        $filtered = array_filter($filteredfn (array $field) => !$this->isAssociation($field));

        $this->addColumns($schema$table$filtered);

        $binary = ['length' => 16, 'fixed' => true];

        $translated = array_filter($fieldsfn (array $field) => $field['translatable'] ?? false);

        
if (is_array($value['msgstr'])) {
      // Sort plural variants by their form index.       ksort($value['msgstr']);
      $plural = TRUE;
    }

    $item = new PoItem();
    $item->setContext($value['msgctxt'] ?? '');
    $item->setSource($value['msgid']);
    $item->setTranslation($value['msgstr']);
    $item->setPlural($plural);
    $item->setComment($comments);
    $item->setLangcode($this->langcode);

    $this->lastItem = $item;

    $this->context = 'COMMENT';
  }

  /** * Parses a string in quotes. * * @param $string * A string specified with enclosing quotes. * * @return bool|string * The string parsed from inside the quotes. False when the syntax is * invalid. */
$blog = $this->getRepository()->find($blogArticleId);
        /** @var Shop $shop */
        $shop = $this->getModelManager()->getReference(Shop::class$this->get('shop')->getId());

        $blogCommentModel->setBlog($blog);
        $blogCommentModel->setCreationDate(new DateTime());
        $blogCommentModel->setActive(false);

        $blogCommentModel->setName($commentData['name']);
        $blogCommentModel->setEmail($commentData['eMail']);
        $blogCommentModel->setHeadline($commentData['headline']);
        $blogCommentModel->setComment($commentData['comment']);
        $blogCommentModel->setPoints($commentData['points']);
        $blogCommentModel->setShop($shop);

        $this->get('models')->persist($blogCommentModel);
        $this->get('models')->flush();
    }

    /** * Returns all data needed to display the pager * * @param int $totalResult * @param int $limitEnd * @param int $page * @param int $categoryId * * @return array */


        if (isset($data['__vote_name'])) {
            $struct->setName($data['__vote_name']);
        }

        if (isset($data['__vote_points'])) {
            $struct->setPoints((float) $data['__vote_points']);
        }

        if (isset($data['__vote_comment'])) {
            $struct->setComment($data['__vote_comment']);
        }

        if (isset($data['__vote_datum']) && $data['__vote_datum'] != '0000-00-00 00:00:00') {
            $struct->setCreatedAt(
                new DateTime($data['__vote_datum'])
            );
        }

        if (isset($data['__vote_email'])) {
            $struct->setEmail($data['__vote_email']);
        }

        
Home | Imprint | This part of the site doesn't use cookies.