我正在为 Mura CMS 添加我自己的 bean 的插件,并且刚刚开始收到不存在的错误。我的一个 bean 具有用于电子邮件、名称、金额等的设置器和获取器,以及一些 bean(即 configBean、priceBean、teamBean)。
当我尝试加载 bean(称为donationBean)时,我收到一个错误,即 ID 电子邮件中不存在 bean。电子邮件不应该基于 bean。除了电子邮件的 getter/setter 之外,我没有添加任何代码,并且错误不是由任何其他属性引起的。这是捐赠 bean 的 getter/setter 部分:
public numeric function getAmount(){ return Variables.data['amount']; }
public void function setAmount(numeric amount){ Variables.data['amount'] = Arguments.amount; }
public any function getConfigBean(){ return Variables.configBean; }
public void function setConfigBean(any configBean){ Variables.configBean = Arguments.configBean; }
public string function getEmail(){ return Variables.data['email']; }
public void function setEmail(string email){ Variables.data['email'] = Arguments.email; }
public string function getId(){ return Variables.data['id']; }
public void function setId(string id){ Variables.data['id'] = Arguments.id; }
public string function getName(){ return Variables.data['name']; }
public void function setName(string name){ Variables.data['name'] = Arguments.name; }
public boolean function getPaid(){ return Variables.data['paid']; }
public void function setPaid(boolean paid){ Variables.data['paid'] = Arguments.paid; }
public any function getPriceBean(){ return Variables.priceBean; }
public void function setPriceBean(any priceBean){ Variables.priceBean = Arguments.priceBean; }
public numeric function getTeamId(){ return Variables.data['teamid']; }
public void function setTeamId(numeric teamid){ Variables.data['teamid'] = Arguments.teamid; }
这是我的 config.xml
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="byName">
<bean id="registrationBean" class="[plugin]lib.registration" />
<bean id="priceBean" class="[plugin]lib.price" />
<bean id="donationBean" class="[plugin]lib.donation" />
</beans>
最后是我加载 bean 的代码(来自 bean 本身):
public any function createForTeamPayment(priceid, teamid, name, email){
var price = getPriceBean().loadBy({priceid=Arguments.priceid});
setAmount(price.getAmount());
setTeamId(Arguments.teamid);
setName(Arguments.name);
setEmail(Arguments.email);
save();
}