extbase

typo3 extbase: validate a form

北城以北 提交于 2019-12-04 15:07:52
I created a simple "subscribe to newsletter" form: <f:form action="subscribe" method="post" name="newsletterform"> <f:form.textfield id="name" name="name" required="true" /> <f:form.textfield id="email" name="email" required="true"/> <button type="submit">Submit</button> </f:form> as you can see, this is not a form that's based on an existing model, I have no interest in saving newslettersubscriptions to the database (they'll be stored somewhere else anyways). Now in my subscripeAction I want to do some form validating. I want to check if the email is really an email address, if its notEmpty

“Map to existing tables” in Extension builder showing weird issues in TYPO3

心已入冬 提交于 2019-12-04 09:56:39
In my extension MyExt , I mapped the model Page to pages table in TYPO3. Firstly it shows me the type mismatch error, I anyhow went ahead and saved it. The following things happen: My Page tree becomes like this: My New Record Form shows only the UIDs and not the titles: My Page Edit becomes like this: In my MyExt/Configuration/TypoScript/setup.txt I have this: config.tx_extbase.persistence.classes { Tx_MyExt_Domain_Model_Page { mapping { tableName = pages } } } Is this a bug ? Or something i'm doing wrong ? This is my /Domain/Model/Page.php , just a glimpse of it. class Page extends \TYPO3

get TYPO3 Extbase Repository items in other languages

扶醉桌前 提交于 2019-12-04 04:29:43
问题 How can i get items from an extbase respository in a different language? What i tested: findByUid($childUid) $query->getQuerySettings()->setRespectSysLanguage(FALSE); $query->getQuerySettings()->setSysLanguageUid(3); But the result is always the parent (lang) object. I tried it with "matching" and with "statement" but the result query uses the active language or searches for sys_language_id in (0,-1) = (default/all). 回答1: It seems that this is a bug in extbase which will not removed until

Typo3 Extbase Repository->findAll() returns empty

耗尽温柔 提交于 2019-12-04 03:47:27
问题 I just can't findAll() make return anything even though I am able to access a specific record by findByUid(). I have taken note (and tried to workaround / set up) of the typoscript solution and the record storage page bug without any success. I am using a dummy extension code made by the extension builder in TYPO3 (current version) for your convenience. I have tested with data manually added through the TYPO3 config ui. Any help would be much appreciated. All the best and thanks in advance

How do I include or autoload external libraries in a TYPO3 Extbase Extension? + Dependecy Injection?

本小妞迷上赌 提交于 2019-12-03 17:41:32
I'm developing a TYPO3 4.6 Extension with Extbase 1.4 and im trying to include an external library. The library, in my case the facebook PHP SDK , is under $_EXTKEY/Resources/PHP/facebook-php-sdk/facebook.php . I would like the library to autoload and automatically inject (Dependecy Injection) where I need it. Some comments I found online suggest that one should include libraries with require_once(): http://forge.typo3.org/issues/33142 if it's just a tiny helper library, it's intended to be stored in {PackageRoot}/Resources/PHP/{libraryName} and just included via require. is this suspected by

TYPO3 6.2 - how to create FileReference in frontend (FE)?

限于喜欢 提交于 2019-12-03 13:37:32
I have the hypothetical Zoo extension in which I've Animal model with photo field and FrontEnd (FE) plugin with typical CRUD actions. photo field is typical FAL's FileReference and it works perfectly in backend (BE) with common TCA IRRE config. I'm able to successful upload the file to the storage, it's visible in the Filelist module, and I can use it in BE during my Animal editing, anyway I can't create FileReference within my FE plugin. My current approach looks like this: /** * @param \Zoo\Zoo\Domain\Model\Animal $animal */ public function updateAction(\Zoo\Zoo\Domain\Model\Animal $animal)

TYPO3 Extbase: update record with logging of changes

烈酒焚心 提交于 2019-12-02 20:04:24
问题 When I update an object with an Extbase repository (e.g. in a cronjob or in the frontend) like this... $myRepository->update($myObject); and afterwards I use button "Display change history / Un-do" for this record in TYPO3 BE, I don't see any history. I only see a history when editing the object in TYPO3 BE. How can I enable the history? 回答1: Short version: you can't, because the history is for changes done in the backend interface only. Longer version: you sort of, kind of can, but that

TYPO3 groupedFor viewhelper according to dates

China☆狼群 提交于 2019-12-02 17:41:32
问题 I have a simple model "item" with 3 properties: title, description, date Now I want to have a list like this: 10.10.17: title item 1 title item 5 12.10.17: title item 8 and so on According to groupedFor - grouping objects according to dates I added a getter like /** * Get day month year of datetime * * @return int */ public function getDayMonthYearOfDatetime() { return (int)$this->datum->format('dmy'); } My list view: <f:groupedFor each="{items}" as="dayMonthYearOfDatetime" groupBy=

Entity to Datamap/Array

流过昼夜 提交于 2019-12-02 11:50:44
问题 I have an Entity like that: class Company extends AbstractEntity { /** * @var string */ protected $longName = ''; //much more properties //all the setters and getters } I would like to use the DataHandler from the typo3 core to save such an Entity, because saving the entity should trigger the whole workspace mechanics, such that the updated Object/Entity/row is created as a new version. Extbase directly writes to the Database, what bypasses that. Basically one can use the api like so: $data =

Good practice on how to set up routeEnhancers for list and detail view of ext:news?

守給你的承諾、 提交于 2019-12-02 11:40:46
问题 Precondition The ext:news list view plugin is on page www.domain.com/news [ID 9] and the detail view on www.domain.com/article [ID 39]. Following the official example (docs.typo3.org) I tried the "Extbase Plugin Enhancer" example of the feature description, but that caused some problems: The pagebrowser link to page 2 has a cHash: news/list/2?cHash=123456789 The pagebrowser link from page 2 to page 1 has lots of get-parameters: news?tx_news_pi1%5Baction%5D=list&tx_news_pi1%5Bcontroller%5D