Project

General

Profile

Actions

Bug #80820

closed

Extbase - Wrong size of QueryResult object after make statement

Added by Miguel Ángel Molina Hernández about 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-04-12
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi,

I used today the method '\TYPO3\CMS\Extbase\Persistence\Generic\Query::statement()' my first time. I didn't have troubles with another methods of the queries of Extbase. But I will try to explain my enviroment.

I have to use this statement, because I need to user the REGEXP in some queries. I tried first:

$query->statement(
    "SELECT * FROM tx_myext_mytable WHERE schluessel != ? AND schluessel REGEXP ?", 
    array($key, '[1-9]{3}' . substr($key, 3, 5) . '.*')
);

,but it returns an error like this:

Uncaught TYPO3 Exception
#1247602160: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? AND schluessel REGEXP ?' at line 1

So, I tried to make it in another way:

 $sql = "SELECT * FROM tx_myext_mytable " 
                    . "WHERE schluessel != ? AND schluessel REGEXP ?";

$query->statement(
    $this->objectManager->get(\TYPO3\CMS\Core\Database\PreparedStatement::class, $sql, 'tx_stala_domain_model_gebiet'), 
    array($key, '[1-9]{3}' . substr($key, 3, 5) . '.*')
);        

now it works but not at all. Also, 'tx_myext_mytable' contents 3060 elements, the result with specifics parameter for this query ($key) returns the corrects elements in an object of type '\TYPO3\CMS\Extbase\Persistence\Generic\Query\QueryResult', but the size of the object is wrong, a few examples of the output from the Extbase Debugger

TYPO3\CMS\Extbase\Persistence\Generic\QueryResultprototypeobject (3013 items)
   0 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1003, pid=97)
   1 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1004, pid=97)
   2 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1005, pid=97)
   3 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1006, pid=97)
   4 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1007, pid=97)
   5 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1008, pid=97)
   6 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1009, pid=97)
   7 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1010, pid=97)
   8 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1011, pid=97)
   9 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1012, pid=97)
   10 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1013, pid=97)
   11 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=1014, pid=97)
TYPO3\CMS\Extbase\Persistence\Generic\QueryResult prototype object (3013 items)
   0 => Vendor\Myext\Domain\Model\VerbandsfreieGemeinde prototype persistent entity (uid=913, pid=95)
   1 => Vendor\Myext\Domain\Model\VerbandsfreieGemeinde prototype persistent entity (uid=920, pid=95)
   2 => Vendor\Myext\Domain\Model\Verbandsgemeinde prototype persistent entity (uid=927, pid=96)
   3 => Vendor\Myext\Domain\Model\Verbandsgemeinde prototype persistent entity (uid=932, pid=96)
   4 => Vendor\Myext\Domain\Model\VerbandsfreieGemeinde prototype persistent entity (uid=952, pid=95)
   5 => Vendor\Myext\Domain\Model\VerbandsfreieGemeinde prototype persistent entity (uid=963, pid=95)
   6 => Vendor\Myext\Domain\Model\Verbandsgemeinde prototype persistent entity (uid=964, pid=96)
   7 => Vendor\Myext\Domain\Model\Verbandsgemeinde prototype persistent entity (uid=1002, pid=96)
TYPO3\CMS\Extbase\Persistence\Generic\QueryResultprototypeobject (3013 items)
   0 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=928, pid=97)
   1 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=929, pid=97)
   2 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=930, pid=97)
   3 => Vendor\Myext\Domain\Model\Gemeinde prototype persistent entity (uid=931, pid=97)

Do i make something wrong? Or Is it a bug of the system?

Thank you


Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #80464: count() not working correctly in Extbase when using custom statementNew2017-03-27

Actions
Actions #1

Updated by Julian Hofmann almost 7 years ago

  • Related to Bug #80464: count() not working correctly in Extbase when using custom statement added
Actions #2

Updated by Tymoteusz Motylewski over 5 years ago

  • Status changed from New to Needs Feedback

Can you please provide minimal test data I could use to reproduce the issue?
Without being able to reproduce it in vanilla TYPO3 the issue can't be fixed.

Actions #3

Updated by Riccardo De Contardi over 5 years ago

  • Status changed from Needs Feedback to Closed

No feedback since the last 90 days => closing this issue.

If you think that this is the wrong decision or experience the issue again and have more information about how to reproduce your problem, please reopen it or open a new issue with a reference to this one.

Thank you and best regards

Actions

Also available in: Atom PDF