TYPO3:为一个扩展名设置多个存储pid [英] TYPO3: Set more than one storage pid for one extension

查看:47
本文介绍了TYPO3:为一个扩展名设置多个存储pid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个扩展,该扩展具有一个"details"表,该表包含带有标题和描述的详细信息,这些详细信息包含在另一个对象的行内.现在,新的详细信息与对象存储在相同的pid中,但是我想更改它.

I builded an extension that has a 'details' table that holds details with a title and a description that be included inline to another object. Right now new details are stored in the same pid as the object, but I'd like to change that.

此问题Merec ,并在注释中指出了解决方案(将"pid"列添加到模型中,这是模型首先查看的模型)但被要求为此提出一个单独的问题...

this question was answered by Merec and in the comments he points to a solution (add the column "pid" to your model, this is the first the model looks at) but asked to formulate a separate question for it ...

我接受了他的建议,但无法使它生效,所以这是一个单独的问题,此外,我想知道如何从配置中获取值以用作pid这个.

I took his suggestion but could not get it to work, so here is the separate question, in addition I would like to know how to get a value from the configuration to be used as pid for this.

更新:RenéPflamm指出我要强调的是,我正在尝试将此Pid设置为保存在后端,而不是在前端...后来基本了解了这种命运

update: René Pflamm pointed out that I should underline that I'm trying to set this Pid for saving in the backend, not in the frontend ... I basically recognized this destinction later on

我的constants.ts:

my constants.ts :

plugin.tx_myext {
  persistence {
    # cat=plugin.tx_myext/storage/a; type=string; label=Default storage PID
    defaultStoragePid =
    # cat=plugin.tx_myext/storage/a; type=string; label=Details storage PID
    detailsStoragePid =
  }
}

我的setup.ts

my setup.ts

plugin.tx_myext {
  persistence {
    storagePid = {$plugin.tx_myext.persistence.defaultStoragePid}
    detailPid = {$plugin.tx_myext.persistence.detailsStoragePid}
  }
}

推荐答案

我不确定我是否理解正确,但是您可以告诉extbase为您的记录查找多个pid,并为应将其存储在每个记录中的状态:

I am not sure if I understood you correctly but you can tell extbase to look in multiple pids for your records and state for each record where it should be stored:

plugin.tx_myext {
  persistence {
    storagePid = {$plugin.tx_myext.persistence.defaultStoragePid},{$plugin.tx_myext.persistence.detailStoragePid}
    classes {
      Vendor\MyExt\Domain\Model\Detail {
        newRecordStoragePid = {$plugin.tx_myext.persistence.detailStoragePid}
      }
    }
  }
}

这篇关于TYPO3:为一个扩展名设置多个存储pid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆