XF 2.2 Entity not found by finder after editing

Taylor J

Well-known member
After editing a blog post and saving the contents, that blog post is not being picked up anymore when running the following finder query:
PHP:
$blogPostFinder = $this->finder('TaylorJ\UserBlogs:BlogPost')
            ->where('blog_id', $params->blog_id)
            ->order('blog_post_date', 'DESC');
(->fetch() is run in the viewParams array setup)

But it is picked up when I use a finder query but without a where statement:
PHP:
$test = $this->finder('TaylorJ\UserBlogs:BlogPost')
            ->fetch();


The blog_id field is still set on the entity in db after save
1722348805383.webp

And here's the values that the finder finds on both of the above queries:
1722348864125.webp

I'm not sure where I messed up on the saving process for an edit to cause this...
 
The blog id is in the db, but is it in your params to match? try echo'ing out your actual sql statement.
It's in the params to match, that's how $blogPostsFinder is able to find 1, 3, 4, 5, 6, 7, and 8 in the last image.

1722355012113.webp
The condition before it's fetched shows that it's looking for the correct blog_id as well.
 
Not sure what was causing the issue but it's fixed now. I did find out that my db viewer, TablePlus, wasn't showing that the blog_id was changed to 0 for some reason until a full system restart.
 
Back
Top Bottom