public function validateDepends(string $key, array $def, $value)
    {
        if (isset($def['depends'])) {
            if ($this->getForm()->{$def['depends']} != '' && $value == '' && !isset($def['depends_value_empty'])) {
                if (isset($def['depends_first_option']) && $this->getDefinition($def['depends'], 'options')) {
                    $options = $this->getDefinition($def['depends'], 'options');

                    reset($options);

                    if ($this->getForm()->{$def['depends']} == key($options)) {
                        $this->addError($key, 'form.value_empty_depends',
                            array(
                                '%other_field%' => $this->getFieldCaption($def['depends']),
                                '%value%' => current($options)
                            )
                        );
                    }
                } elseif (isset($def['depends_last_option']) && $this->getDefinition($def['depends'], 'options')) {
                    $options = $this->getDefinition($def['depends'], 'options');

                    end($options);

                    if ($this->getForm()->{$def['depends']} == key($options)) {
                        $this->addError($key, 'form.value_empty_depends',
                            array(
                                '%other_field%' => $this->getFieldCaption($def['depends']),
                                '%value%' => current($options)
                            )
                        );
                    }
                } elseif (!isset($def['depends_value']) || $this->getForm()->{$def['depends']} == $def['depends_value']) {
                    $this->addError($key, 'form.value_empty');
                }
            } elseif ($this->getForm()->{$def['depends']} == '' && $value == '' && isset($def['depends_value_empty'])) {
                $this->addError($key, 'form.value_empty',
                    array(
                        '%other_field%' => $this->getFieldCaption($def['depends'])
                    )
                );
            }
        }
    }