Scandal
Well-known member
Hello all!
I have built an
It uses as intended a
We're talking about User entity which fetched as
On
The problem: script was returning error:
ProfileBanner.php line 246 is the following (
Currently I have added a class extension to replace the above method and doing this before
... so as to not have this error.
How could I fix this via a more normalize way?
I have built an
\XF\Job\AbstractRebuildJob
extension class for running my own rebuilding job.It uses as intended a
protected function getNextIds($start, $batch)
method and the protected function rebuildById($id)
.We're talking about User entity which fetched as
$id
.On
rebuildById($id)
I do the following:
PHP:
$user = $this->app->em()->find('XF:User', $id, []);
// [...] some checks
$user->delete(false);
The problem: script was returning error:
ErrorException: [E_NOTICE] Trying to get property 'banner_date' of non-object in src\XF\Service\User\ProfileBanner.php at line 246
ProfileBanner.php line 246 is the following (
if ($this->user->Profile->banner_date)
):
PHP:
protected function deleteBannerFiles()
{
if ($this->user->Profile->banner_date)
{
foreach ($this->sizeMap AS $code => $size)
{
\XF\Util\File::deleteFromAbstractedPath($this->user->Profile->getAbstractedBannerPath($code));
}
}
}
Currently I have added a class extension to replace the above method and doing this before
if ($this->user->Profile->banner_date)
:if (isset($this->user->Profile->banner_date))
... so as to not have this error.
How could I fix this via a more normalize way?