1

I am working on a plugin for Mura CMS adding in my own beans, and just started getting an error that one doesn't exist. One of my beans has setters and getters for email, name, amount, etc. as well as some beans (ie. configBean, priceBean, teamBean).

When I try to load up the bean (called donationBean) I get an error that no bean exists with the ID email. Email is not supposed to be based off a bean. I haven't added any code besides the getter/setter for email and the error doesn't arise from any other properties. Here is the getter/setter section of the donation bean:

  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; }

And here's my 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>

And finally my code to load up the bean (from within the bean itself):

  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();
  }
Dave Long
  • 9,569
  • 14
  • 59
  • 89
  • Maybe 'byName' saw the email property, but no bean with id email. Maybe you shouldn't use 'byName'. – Henry Mar 26 '12 at 18:09
  • I am confused, then, as to why none of the other properties of the bean are autowired. It was fine before the email property was added. – Dave Long Mar 26 '12 at 18:41

2 Answers2

0

Most likely a namespace collision ... EmailID is in the mura namespace ... You might try setting a local scope for the vars ...

Checkout ~ requirements\mura\bean\beanFactory.cfc ...

    <cfset variables.transientAlias["email"]="emailBean"/>

And too ~ requirements\mura\email\emailBean.cfc

    <cfcomponent extends="mura.bean.bean" output="false">

    <cfproperty name="emailID" type="string" default="" required="true" />
Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
0

I found that if I changed the email property to another name, in my case donorEmail, then everything started to work. I have no idea why, as there is no bean with ID email and it wasn't being called as a bean.

Dave Long
  • 9,569
  • 14
  • 59
  • 89
  • If there are no other answers by the time that I can mark this as the answer then I will mark this as one. I don't like this as an answer because I don't like "it just started working" kind of answers. – Dave Long Mar 26 '12 at 19:02
  • I'm curious if scoping your function calls would make any difference, such as this.setEmail(arguments.email);. Could there be another setEmail function floating around out there? – Dan A. Mar 26 '12 at 23:12
  • Possibly. Since I am pulling in Mura's coldspring beans, there could be something out there somewhere, but as far as I know there isn't. When I'm not on a time crunch I'll test out if using 'this' fixes anything. – Dave Long Mar 27 '12 at 01:34