Comments (2)
It is worth noting, this behaviour is not present if assigning withTraits
or withTrait
to a variable, then printing the var (this does not match with the docs however)
$LoggedInID = new Identity('test');
$test = $LoggedInID->withTraits([
(new IdentityTrait('session_id'))->withValue('123'),
(new IdentityTrait('email'))->withValue('[email protected]'),
]);
echo var_export($test, true);
Flagsmith\Models\Identity::__set_state(array(
'id' => 'test',
'traits' =>
array (
0 =>
Flagsmith\Models\IdentityTrait::__set_state(array(
'id' => NULL,
'key' => 'session_id',
'value' => '123',
)),
1 =>
Flagsmith\Models\IdentityTrait::__set_state(array(
'id' => NULL,
'key' => 'email',
'value' => '[email protected]',
)),
),
'flags' => NULL,
))
Either the docs need to be updated, or the clone properties need to be saved properly.
from flagsmith-php-client.
Hi @JustinBack Right this code should work (I've updated the docs for this):
$identity = new \Flagsmith\Models\Identity('identity');
$identityTrait = (new \Flagsmith\Models\IdentityTrait('Foo'))->withValue('Bar');
$identity = $identity->withTrait($identityTrait);
$flagsmith = new \Flagsmith\Flagsmith('apiToken');
$flagsmith->getFlagsByIdentity($identity);
from flagsmith-php-client.
Related Issues (11)
- Create a release HOT 1
- Cache getting incorrectly accessed/read HOT 4
- Mocking routes directly from file HOT 4
- Resolve `jsonSerialize` deprecation warnings
- Possibility to implement PSRs? (Through Community submitted PR) HOT 2
- Version v3.1.2 is not visible in Composer/Packagist HOT 1
- Tests are failing for some reason HOT 1
- Identity overrides in local evaluation mode
- Create an OpenFeature provider
- Initital value not nullable.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flagsmith-php-client.