Blog example

$this->attributeHydrator = $attributeHydrator;
    }

    /** * @return Blog */
    public function hydrate(array $data)
    {
        $translation = $this->getBlogTranslation($data);
        $data = array_merge($data$translation);

        $blog = new Blog();

        $blog->setId((int) $data['__blog_id']);
        $blog->setTitle($data['__blog_title']);
        $blog->setAuthorId($data['__blog_author_id'] !== null ? (int) $data['__blog_author_id'] : null);
        $blog->setActive((bool) $data['__blog_active']);
        $blog->setShortDescription($data['__blog_short_description']);
        $blog->setDescription($data['__blog_description']);
        $blog->setViews((int) $data['__blog_views']);
        $blog->setDisplayDate($data['__blog_display_date'] ? date_create($data['__blog_display_date']) : null);
        $blog->setCategoryId((int) $data['__blog_category_id']);
        $blog->setTemplate($data['__blog_template']);
        
$id = (int) $this->Request()->getParam('id');

        if (!empty($id)) {
            // Edit Data             /** @var Blog $blogModel */
            $blogModel = $this->getManager()->getRepository(Blog::class)->find($id);
            // Deletes all old blog tags             $this->deleteOldTags($id);
        } else {
            // New Data             $blogModel = new Blog();
        }
        // Setting the date in this way cause ext js got no datetime field         $params['displayDate'] = $params['displayDate'] . ' ' . $params['displayTime'];

        if (!$params['shopIds']) {
            $params['shopIds'] = null;
        }

        $this->prepareTagAssociatedData($params$blogModel);
        $params = $this->prepareAssignedArticlesAssociatedData($params);
        $params = $this->prepareAuthorAssociatedData($params);

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