Answer the question
In order to leave comments, you need to log in
Combined oneToMany relationships User->RelationCollection[ApiTokenCollection, ResetPassCollection]?
class User implements UserInterface, IAggregateRoot {
public ActivationTokenCollection $activationTokens;
public ApiTokenCollection $apiTokens;
public ResetPasswordTokenCollection $resetPassTokens;
// other tokens...
class User implements UserInterface, IAggregateRoot {
public TokensCollections $tokens;
// other tokens...
public function getTokens(){
// output ArrayCollection->toArray() ---> [ActivationTokenCollection, ApiTokenCollection, ResetPasswordTokenCollection]
}
public function getApiTokens(){
// output ArrayCollection->toArray() [ApiTokenCollection]
}
Answer the question
In order to leave comments, you need to log in
If I understand your question correctly, then you can make the AbstractToken
base entity for inheritance mapping , and inherit other types of tokens from it, defining them in @DiscriminatorMap
.
Then, if somewhere you need to get a list of only a certain type of tokens, it will be enough in the definition, for example, @OneToMany
to specify targetEntity
the entity class you need, and if all the tokens are needed, then you can specifyAbstractToken
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question