[TYPO3-mvc] Problems with setIgnoreEnableFields
Sebastian g
reg at sg-multimedia.de
Tue Jul 28 15:16:53 CEST 2015
Hello,
I just build a "mini news" extension which has 3 plugins: list, details, archive. The problem is that the list should only display the items within "starttime" and "endtime" range, but the archive plugin should ignore these fields and only respect the "archive"-flag (checkbox).
I've just done the following steps in my Repository:
// 1: Ignore starttime and endtime by default
public function initializeObject() {
$querySettings = $this->objectManager->create('Tx_Extbase_Persistence_Typo3QuerySettings');
$querySettings->setRespectStoragePage(FALSE);
$querySettings->setIgnoreEnableFields(true);
$querySettings->setEnableFieldsToBeIgnored(array("starttime","endtime"));
$this->setDefaultQuerySettings($querySettings);
}
// 2: Respect starttime and endtime (for list plugin)
public function getByCompany($companyUid){
$query = $this->createQuery();
$querySettings = $query->getQuerySettings();
$querySettings->setIgnoreEnableFields(false);
$query->setQuerySettings($querySettings);
$query->matching(
$query->logicalOr(
$query->equals("company", 0),
$query->equals("company", $companyUid)
)
);
return $query->execute();
}
The two functions which list the articles (list,archive) work as expected.
The problem is, that if I select an item in the archive (which is not within the "starttime" and "endtime" range) there's an error:
"Exception while property mapping at property path "":Object with identity "23" not found." (The "23" is the uid of the article).
Any ideas?
--
______
regards
Seb
More information about the TYPO3-project-typo3v4mvc
mailing list