samples-php icon indicating copy to clipboard operation
samples-php copied to clipboard

[Bug] Wrong prefix in the samples

Open azngeek opened this issue 1 year ago • 0 comments

What are you really trying to do?

Describe the bug

The current samples need to have their own prefix, which is basically the last part of the Namespace of the Activity. At least in this setup.

However, if you do not know, that the LocalActivity-Interfaces uses SimpleActivity as a prefix, any change made to the class Temporal\Samples\SimpleActivity\GreetingActivity will not be respected.


<?php

/**
 * This file is part of Temporal package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Temporal\Samples\LocalActivity;

use Temporal\Activity\LocalActivityInterface;
use Temporal\Activity\ActivityMethod;

#[LocalActivityInterface(prefix: 'SimpleActivity.')]
interface GreetingActivityInterface
{
    #[ActivityMethod(name: "ComposeGreeting")]
    public function composeGreeting(
        string $greeting,
        string $name
    ): string;
}

Minimal Reproduction

  1. Change any code in the method Temporal\Samples\SimpleActivity\GreetingActivity::composeGreeting().
  2. Ensure that you edited the method in the namespace SimpleActivity!
  3. Reset the worker ./rr reset
  4. Run php app.php simple-activity
  5. You will see that the output comes from Temporal\Samples\LocalActivity\GreetingActivity::composeGreeting()
<?php

/**
 * This file is part of Temporal package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Temporal\Samples\SimpleActivity;

use Temporal\Activity;

// @@@SNIPSTART php-hello-activity
class GreetingActivity implements GreetingActivityInterface
{
    public function composeGreeting(string $greeting, string $name): string
    {
        return $greeting . ' my code changes ' . $name;
    }
}
// @@@SNIPEND

Environment/Versions

  • OS and processor: Macbook Pro M1
  • This docker-setup

Additional context

azngeek avatar Nov 02 '23 12:11 azngeek