script

Wednesday, May 16, 2012

TYPO3 : Call repository of external extension in ext base

//parameters match with uid of table
$matchVal = 1;

//create object of repository that need to be called
$jobs = new Tx_Jobs_Domain_Repository_JobsRepository();   


//create query and get details of all properties under model
$query = $jobs->createQuery();
$cond = $query->equals("uid",$matchVal);
$query->matching($cond);


//for fetching just one property (only description will be fetched)
$row = $query->execute()->getFirst()->getDescription();
print_r($row);

//for fetching all property (All properties will be fetched)
$row = $query->execute()->getFirst();
print_r($row);

1 comment:

  1. it is better to use the objectManager to create a new Repository Object.

    $this->objectManager->get('Tx_Jobs_Domain_Repository_JobsRepository');

    or namspaced:
    $this->objectManager->get('Vendor\Jobs\Domain\Repository\JobsRepository');

    ReplyDelete