1
votes

I'm creating a custom phing task and trying to pass data to it via nested xml elements. My task executes fine but errors out when it attempts to "create" a nested element. For example:

Portion of xml build file:

<mycustomtask>
    <option name="opt1" value="val1"/>
</mycustomtask>

Portion of task class file:

...
public function createOption(){
    return new Option;
}
...

Portion of Option class file:

class Option{
    ...
    public function setName($str){
        $this->name = $str;
    }
    public function setValue($str){
        $this->value = $str;
    }
}

My task always errors out with an exception from the Introspection Helper with "...doesn't support 'name' attribute".

Can anyone show me what I'm doing wrong here? I've started tracing back through the introspection helper class but didn't get very far. I've also tried adding the @return doc directive in my method phpdoc as I can see the introspection helper tries to parse them.

Alternatively, is there another way of passing lots of arguments/options to a custom task in xml?

1

1 Answers

0
votes

Your tag class should extend the DataType class. Without that, phing will give you problems.

If that does not help, provide a paste with the minimal (but complete) code to reproduce the problem.