Skip to content

extends \Phalcon\Tag #2402

Closed
Closed
@devate

Description

@devate

Hi everyone!

First of all thanks for this great framework!!!

I'm trying to extends \Phalcon\Tag class, to override the getValue() method. I want to get value from the POST array for the form fields with names like array (e.g. user[email]).

But when I simply extends the class:

namespace ...;

class Tag extends \Phalcon\Tag {

}

stopped correct working the setDefault() method :( In array _displayValues ​​only have the last assigned value. Also desired function getValue() do not overridden.

This is a bug or am I doing something wrong?

OS: Windows 8 (local server)
php 5.4.13 / 5.5.10
Phalcon 1.3.1

My code examples:

// services.php
...
use MyProject\Library\Tag\Tag;

$di->set('tag', function () {
  $tag = new Tag();
  return $tag;
});

...

// Tag.php

namespace MyProject\Library\Tag;

class Tag extends \Phalcon\Tag
{
  // empty class
}

The next step in the my controller I write this code:

$this->tag->setDefault('field1', 11);
$this->tag->setDefault('field2', 22);
$this->tag->setDefault('field3', 33);

As a result, the first two fields are clean, and the third set the desired value to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions