Emotion example

if (!$emotion) {
                $this->View()->assign([
                    'success' => false,
                    'data' => $this->Request()->getParams(),
                    'message' => $namespace->get('no_valid_id', 'No valid emotion id passed.'),
                ]);

                return null;
            }
        } else {
            $emotion = new Emotion();
            $emotion->setCreateDate(new DateTime());
        }

        $template = null;
        if (!empty($data['templateId'])) {
            $template = $this->get('models')->find(Template::class$data['templateId']);
        }

        $validFrom = null;
        if (!empty($data['validFrom'])
            && !empty($data['validFromTime'])) {
            
public function __construct(AttributeHydrator $attributeHydrator)
    {
        $this->attributeHydrator = $attributeHydrator;
    }

    /** * @return Emotion */
    public function hydrate(array $data)
    {
        $emotion = new Emotion();

        $emotion->setId((int) $data['__emotion_id']);
        $emotion->setActive((bool) $data['__emotion_active']);
        $emotion->setName($data['__emotion_name']);
        $emotion->setCols((int) $data['__emotion_cols']);
        $emotion->setCellSpacing((int) $data['__emotion_cell_spacing']);
        $emotion->setCellHeight((int) $data['__emotion_cell_height']);
        $emotion->setArticleHeight((int) $data['__emotion_article_height']);
        $emotion->setRows((int) $data['__emotion_rows']);
        $emotion->setValidFrom($this->createDate($data['__emotion_valid_from']));
        $emotion->setValidTo($this->createDate($data['__emotion_valid_to']));
        
Home | Imprint | This part of the site doesn't use cookies.