简体   繁体   中英

TYPO3 how to make query using $this->createQuery();

I have TYPO3 version 7.6.18

I need execute this query SELECT * from table WHERE something != something AND (something = something OR something = something)

$query = $this->createQuery();

$query->matching(
    $query->logicalNot(
        $query->equals('deleted_by_user', $userUid)
    )
);
$query->matching(
    $query->logicalOr(
        $query->equals('user_from', $userUid),
        $query->equals('user_to', $userUid)
    )
);

return $query->execute();

this code does't work properly. Help me please anybody

    $query = $this->createQuery();
    $constraints = array();

    $constraints[] = $query->logicalNot($query->equals('deleted_by_user', $userUid));
    $constraints[] = $query->logicalOr($query->equals('user_from', $userUid), $query->equals('user_to', $userUid));
    $query->matching($query->logicalAnd($constraints));

    return $query->execute();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM