Modify

Ticket #232 (assigned enhancement)

Opened 4 years ago

Last modified 2 years ago

Multiple parameters for foreach task

Reported by: cweiske@… Owned by: mrook
Priority: major Milestone: TBD
Component: phing-core Version: 2.3.0
Keywords: Cc:

Description

It would be really helpful if <foreach> would not only support calling a task with a single parameter but several, like in:

        <foreach list="${phpcsDirs}" param="package" target="sniffOne">
            <property name="dir.package" value="${dir.cvs.pear}/${package}" />
            <property name="file.log" value="${dir.log.phpcs}/${package}.xml" />
<!--             <echo msg="${package}"/> -->
        </foreach>

Attachments

Change History

comment:1 Changed 4 years ago by cweiske@…

I just saw that phing actually supports this half. It does, however, not fill in the property correclty in the subproperty definitions:

<?xml version="1.0" encoding="utf-8"?>
<project name="foreach-with-properties" default="foreach" basedir=".">
    <target name="foreach">
        <foreach list="a,b" param="letter" target="sayHi">
            <property name="salutation" value="Hello ${letter}!" />
        </foreach>
    </target>

    <target name="sayHi">
        <echo msg="${salutation}"/>
    </target>
</project>

I get

     [echo] Hello ${letter}!
     [echo] Hello ${letter}!

instead of

     [echo] Hello a!
     [echo] Hello b!

comment:2 Changed 3 years ago by mrook

  • Owner changed from hans to mrook
  • Status changed from new to assigned

comment:3 Changed 2 years ago by mrook

Related to #320.

comment:4 Changed 2 years ago by mrook

  • Milestone changed from 2.4.0RC1 to 3.0

Moving this to milestone 3.0 for now (because of #320)

View

Add a comment

Modify Ticket

Action
as assigned
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.