$FieldEntity->getValue("field_id");
An exception occurred: [Error] Call to undefined method XF\Mvc\Entity\Finder::getValue()
Oh well, if your Entity is literally called field it would be
$Field->getValue("field_id");
$GamerProfile->getValue("gamerprofile_id");
and it still gives the same error.Did you instantiate the entitity and assign it to $GamerProfile?
Two possibilities, either use the finder system to get an object of your entity oder construct an entity. How did you create your custom entity anyways?
protected function getGamerProfileRepo()
{
return $this->repository('AH\GamerProfiles:GamerProfile');
}
public function getGamerProfiles()
{
return $this->getGamerProfileRepo()->findGamerProfilesForList();
}
$gamerprofileId = $this->getGamerProfiles()->getValue("gamerprofile_id");
I just use:
Code:$entity->property_id
$finder = $this->findGamerProfileValues();
$finder
->with('User')
->with('GamerProfile')
->where('user_id', '=', $visitor)
->where('gamerprofile_id', '=', $gamerprofileId);
->where('gamerprofile_id', '=', $gamerprofileId);
?LogicException: Unknown relation gamerprofile_id accessed on xf_ah_gamerprofile in src/XF/Mvc/Entity/Finder.php at line 90
Code:$finder = $this->findGamerProfileValues() ->with(['User','GamerProfile']) ->where('user_id', $visitor) ->where('GamerProfile.gamerprofile_id', $gamerprofileId) ->fetchOne();
Then the issue is in your entity.
foreach($gamerprofiles as $gamerprofileId => $gamerprofile)
{
$gamerprofile = $gamerprofile->toArray();
$gamerprofileId = $gamerprofile['gamerprofile_id'];
$gamerprofileValue = $this->getGamerProfileValueRepo()->getGamerProfileValuesForUser($userId, $gamerprofileId);
}
public function getGamerProfileValuesForUser($userId, $gamerprofileId)
{
$gamerprofileValues = $this->finder('AH\GamerProfiles:GamerProfileValue')
->with(['User','GamerProfile'])
->where([
'user_id' => $userId,
'gamerprofile_id' => $gamerprofileId
]
)->fetch();
foreach ($gamerprofileValues AS $gamerprofileValueId => $gamerprofileValue)
{
$gamerprofileValue = $gamerprofileValue->toArray();
}
return $gamerprofileValue;
}
foreach($gamerprofiles as $gamerprofileId => $gamerprofile)
, it would find the id for each gamer profile, but it's only returning the last one.We use essential cookies to make this site work, and optional cookies to enhance your experience.