AndyB
Well-known member
I'm trying to make this work using the finder:
In the setup.php file the andy_weekly_digest_opt_out is added. Now if I use raw MySQL query it works fine, but when I try to use the finder it fails:
I tried extending the User entity like this:
But it's not adding the column as I would expect.
Thank you for your help.
PHP:
$finder = \XF::finder('XF:User');
$members = $finder
->where('last_activity', '>', $dateline)
->where('user_state', 'valid')
->where('is_banned', 0)
->where('andy_weekly_digest_opt_out', 0)
->where('Option.receive_admin_email', 1)
->where('Option.is_discouraged', 0)
->fetch();
In the setup.php file the andy_weekly_digest_opt_out is added. Now if I use raw MySQL query it works fine, but when I try to use the finder it fails:
I tried extending the User entity like this:
PHP:
<?php
namespace Andy\WeeklyDigest\XF\Entity;
use XF\Mvc\Entity\Entity;
use XF\Mvc\Entity\Structure;
class User extends XFCP_User
{
public static function getStructure(Structure $structure)
{
$structure = parent::getStructure($structure);
$structure->columns = [
'andy_weekly_digest_opt_out' => ['type' => self::BOOL, 'default' => false]
];
return $structure;
}
}
But it's not adding the column as I would expect.
Thank you for your help.