samples-php
samples-php copied to clipboard
[Bug] Wrong prefix in the samples
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
- Change any code in the method
Temporal\Samples\SimpleActivity\GreetingActivity::composeGreeting()
. - Ensure that you edited the method in the namespace
SimpleActivity
! - Reset the worker
./rr reset
- Run
php app.php simple-activity
- 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