duan1982453 2014-09-27 16:27
浏览 64

TYPO3 6.2 Extbase:仍然修改了持久对象

this may be a Simple issue and im just overseeing it.

What I wanna do:

I have a Model and I simply create an instance of it, fill it with Data and then use the add($object) function of my Repository. Then I Call the persistenceManager to persist my Entry.

The whole Controller is part of an Backend Module.

I have to Persist the Entry Manualy, because there is a @header Redirect, because of an SSO API Call which redirects me afterwards back.

What is the Problem:

My Debugs hint that after adding Values to the Object the Propertys filled to the Object correctly. After calling the persistAll function, my Object is Persisted, but the Values appear as "modified".

The result is:

I have an Empty Object in my Table.

Time for some Code (shortened)

/**
 * myObjectRepository
 *
 * @var \MyVendor\MyExt\Domain\Repository\MyObjectRepository
 * @inject
 */
protected $myObjectRepository;

/**
 * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
 * @inject
 */
protected $objectManager;

/**
 * @var \TYPO3\CMS\Extbase\Persistence\PersistenceManagerInterface
 * @inject
 */
protected $persistenceManager;

/**
 * action verify
 *
 * @return void
 */
public function verifyAction() {
    $myObject = $this->objectManager->get('\\MyVendor\\MyExt\\Domain\\Model\\MyObject');
    $myObject->setName('Nice Name');
    $myObject->setAge(20);

    $this->myObjectRepository->add($myObject);
    $this->persistenceManager->persistAll();
}

This is to give an Idea of what I try to do.

I'm kinda stunned with this issue. The normal Behaviour should be a Persisted Database Entry. Maybe its just a Simple detail overseen.

  • 写回答

1条回答 默认 最新

  • duanjiao4763 2015-08-10 10:46
    关注

    same problem here! Debugging shows, that the persistObject-function called the $dataMap->isPersistableProperty($propertyName) function before pass the data to DB.

    this function needs an TCA

    /**
     * Returns TRUE if the property is persistable (configured in $TCA)
     *
     * @param string $propertyName The property name
     * @return boolean TRUE if the property is persistable (configured in $TCA)
     */
    public function isPersistableProperty($propertyName) {
        return isset($this->columnMaps[$propertyName]);
    }
    

    so, be sure your TCA isset and correct to pass the properties to the DB

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动