[TYPO3-mvc] extending tx_news with own object

Johannes C. Schulz - EnzephaloN IT-Solutions info at enzephalon.de
Tue Jun 4 12:52:51 CEST 2013


Hello extbase-friends

Today I'm writing, cause my way of extending tx_news doesn't really work. In
Backend it looks fine for now. But in frontend my assigned object will ot be
displayed.

In my extension I created a new model called News:
namespace Enzephalon\Psoabilling\Domain\Model;
class News extends Tx_News_Domain_Model_NewsDefault{
  /**
   * @var
\TYPO3\CMS\Extbase\Persistence\Generic\ObjectStorage<\Enzephalon\Psoabilling
\Domain\Model\Band>
   */
  protected $psoabilling;
  /**
       * The constructor.
       */
       public function __construct() {
             $this->psoabilling =
$this->objectManager->get('Enzephalon\\Psoabilling\\Domain\\Model\\Band');
       }  
  /**
   * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $psoabilling
   * @return void
   */
  public function
setPsoabilling(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface
$psoabilling){
    $this->psoabilling = $psoabilling;
  }
  /**
   * @return \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $psoabilling
   */
  public function getPsoabilling(){
    return $this->psoabilling;
  }
}

The setup.txt has a mapping to assign News to Psoabilling:
plugin.tx_news.persistence{
  classes {
    Tx_News_Domain_Model_News{
      subclasses{
        0 = Tx_Psoabilling_Domain_Model_News
      }
    }
    Tx_Psoabilling_Domain_Model_News {
      mapping {
        tableName = tx_news_domain_model_news
        recordType = 0
      }
    }
  }
}

Now I try to display my "psoabilling"-objects inside a news-item:
<f:if condition="{newsItem.psoabilling}">
      <h2>Booking-News:</h2>
      <f:for each="{newsItem.psoabilling}" as="band">
        <img src="{band.logo}" />
        <ul>
          <li>Origin: <img src="{band.origin}" /></li>
          <li>Style: {band.style}</li>
          <li>Roots: {band.roots}</li>
          <f:if condition="{band.homepage}"><li><a href="{band.homepage}"
target="_blank">{band.homepage}</a></li></f:if>
          <f:if condition="{band.myspace}"><li><a href="{band.myspace}"
target="_blank">{band.myspace}</a></li></f:if>
        </ul>
        <span
class="text"><f:format.html>{band.textde}</f:format.html></span>
        <img src="{band.photo}" />
      </f:for>
    </f:if>

But sadly nothing is displayed. If I do a
<f:debug>{newsItem.psoabilling}</f:debug> the output is NULL.

Can somebody tell me whats wrong with my model?

 

Thanks a lot

Johannes



More information about the TYPO3-project-typo3v4mvc mailing list