XF 2.2 Attempt to assign property "shortName" on null

Robert9

Well-known member
I have a finder; when i use:

Code:
$topicFinder = $this->finder('XFRM:Category');
$topicFinder
            ->where('resource_category_id', '1')
            ->fetch();

I get a result.

Now I do the same with mya table:

Code:
$topicFinder = $this->finder('Xencafe\News:News');
$topicFinder
            ->where('news_id', '1')
            ->fetch();

I get the error message:

Attempt to assign property "shortName" on null

I have checked everything ten and more times.
I have a table, I have an entity, I have a content type.

What else do I miss? Any Idea how to find it, please?
 
But ... when I use my relations I have always JOINS,
but sometimes i just dont need them.

Is there a way to do a query without the relations, please?

can I say finder->please go on->without_relation(User)
 
Joins are only performed automatically if you're setting a clause on a relation or have some defaultWith relations set on the structure. If it's the latter, you can opt out when grabbing the finder:

PHP:
$finder = $this->em()->getFinder('Some:Entity', false);
 
Thank you;
you may, can explain to me why this here will show me the whole universe, please?

Code:
 $topicFinder
            ->where('topic_state', 'visible')
            ->whereOr(
                [
                    ['language_id', '=', $languageId],
                    ['language_id', '=', 0],
                ]
            )
            ->order('display_order', 'ASC')
            ->fetch();

        return $topicFinder;

I just want to have some rows of a table, but I get soooooooooooooo much other stuff.
How can I have just my rows, please?
 
You'd have to post more code, including the topic entity in question (or at least its structure) and what unexpected stuff you're getting and how you know you're getting it.
 
Top Bottom