[TYPO3-ttnews] tx_news - Extend news fields with custom extension
bernd wilke
t3ng at bernd-wilke.net
Wed Jul 10 17:35:10 CEST 2013
Am 10.07.13 15:58, schrieb bernd wilke:
> Am 13.06.13 05:27, schrieb Georg Ringer:
>> Hi,
>>
>> yes sorry I don't cover that currently in the manual as this is usually
>> known. This is not related to extbase or news at all.
>>
>> use extension "kickstarter" to create this code.
>>
>> I will try to come up with a new section in the manual the next days
>>
>
> I tried to extend tx_news, but used the extension_builder as I use TYPO3
> 6.1.
> But the extension_builder uses namespaces since 6.0 and so some
> configuration is wrong (or I did feed it wrong into the
> extension_builder???)
>
> my configuration in the extension_builder:
>
> Model object name [News]
> :
> Map to existing table: [tx_news_domain_model_news]
> Extend existing model Class: [Tx_News_Domain_Model_News]
>
> with this a file
> my_ext/Classes/Domain/Model/News.php is generated with these lines:
>
> <?php
> namespace vendor\MyExt\Domain\Model;
> [...]
> class News extends Tx_News_Domain_Model_News {
> [...]
>
> calling the detail-view ends in an error:
> Fatal error: Class 'vendor\MyExt\Domain\Model\Tx_News_Domain_Model_News'
> not found in /var/www/typo3conf/ext/my_ext/Classes/Domain/Model/News.php
> on line 35
>
> I think it is about the namespaces but which namespace should be used
> for the news-extension?
> I also tried
> class News extends \TYPO3\News\Domain\Model\News {
> but it helped nothing, just a changed path, where the class is missing.
>
> bernd
seams the solution is very easy:
class News extends \Tx_News_Domain_Model_News {
^ just this slash
but now the configuration is messed up somewhere else.
As the extension_builder created a new record variant which was not
intended I had to clear/clean a lot of EB-code inspired by [1].
Maybe I cleared too much, or defined too less:
Fatal error: Call to a member function rewind() on a non-object in
/var/www/typo3temp/Cache/Code/cache_phpcode/Domain_Model_News.php on
line 460
this seams to be the full code of the News-Class
001 <?php
002 /***********************************************************************
003 this is partial from:
/var/www/v61/typo3conf/ext/news/Classes/Domain/Model/News.php
004 ***********************************************************************/
:
028 /**
029 * News model
030 *
031 * @package TYPO3
032 * @subpackage tx_news
033 */
034 class Tx_News_Domain_Model_News extends
Tx_Extbase_DomainObject_AbstractEntity {
:
453 /**
454 * Get first category
455 *
456 * @return Tx_News_Domain_Model_Category
457 */
458 public function getFirstCategory() {
459 $categories = $this->getCategories();
460 $categories->rewind();
461
462 return $categories->current();
463 }
as I have not touched anything about categories: what is missing?
[1]
http://keinerweiss.de/525-die-extbase-extension-news-um-ein-feld-erweitern.html
bernd
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-project-tt-news
mailing list