[TYPO3-mvc] Cannot get findByProperty to work

Mark Kuiphuis spam at markyourweb.com
Mon Jan 2 10:09:25 CET 2012


Damn...that took me a while to figure this one out.....
Really starting to enjoy the non descriptive error messages (if any error message at 
all) (*NOT*)

Turned out that I had to do this:

$orders = $this->orderRepository->findByTransactionId($transactionId)->toArray();

instead of only:

$orders = $this->orderRepository->findByTransactionId($transactionId);

I found this snippet from Franz Koch after searching the net for quite some hours 
today...

 > the reason for this is, that as of Extbase 1.3 the repository doesn't
 > any longer return a array but a queryResultObject, and thus the
 > array_merge fails. In order to get it working try adding ->toArray()
 > after "findByStates(...)" (findByStates($allowedStates)->toArray()).

 > --
 > kind regards,
 > Franz Koch

Thanks Franz :-)

Regards, Mark

On 2/01/12 5:17 PM, Mark Kuiphuis wrote:
> Hi Georg,
>
> I hadn't, but just added this one, but no change...(orders are saved in PID 0
> anyway)..could that maybe generating the error?
>
> I also tried to override this function in the OrderRepository with the following
> function:
>
> public function findByTransactionId($transactionId){
> $query = $this->createQuery();
> $query->getQuerySettings()->setRespectStoragePage(FALSE);
>
> return $query->matching($query->equals('transaction_id', $transactionId))->execute();
> }
>
> I do use the setRespectStoragePage(FALSE) there...(however, orders are saved in PID
> 0...something else I need to solve :(
>
> The generated SQL looks like this:
>
> SELECT tx_travelprograms_domain_model_order.* FROM
> tx_travelprograms_domain_model_order WHERE
> tx_travelprograms_domain_model_order.transaction_id = ? AND
> tx_travelprograms_domain_model_order.deleted=0 AND
> tx_travelprograms_domain_model_order.hidden=0 AND
> tx_travelprograms_domain_model_order.pid IN (0)
>
> Without debugging with Tx_ExtDebug::var_dump($orders) I do get to see the view, but
> no variables {order.uid} etc. etc. will be replaced...(but are added to the view with
> $this->view->assign('order', $order);
>
> With debugging with Tx_ExtDebug::var_dump($orders) I do get the error:
>
> #1210859206: Cannot return value of private property "warning.
>
> Tx_Extbase_Reflection_Exception thrown in file
> /private/var/www/typo3_src/typo3_src-4.5.10/typo3/sysext/extbase/Classes/Reflection/PropertyReflection.php
> in line 95.
>
> Potentially this could be an Ext_Debug bug... but looking in the
> PropertyReflection.php class it looks like $this->isPrivate() returns TRUE....but the
> property $transactionId in the model has been set to protected..(I also tried public,
> but again to no avail)....
>
> Thanks, Mark
>
> On 2/01/12 4:50 PM, Georg Ringer wrote:
>> Hi Mark,
>>
>> did you set the pid in your TS?
>> this would be plugin.tx_extkey.persistence.storagePid
>>
>> byUid ignores this setting but all of the others do you use this.
>>
>> georg
>



More information about the TYPO3-project-typo3v4mvc mailing list