[TYPO3-mvc] Tx_Extbase_MVC_Exception_InfiniteLoop

Mark Kuiphuis spam at markyourweb.com
Thu Dec 29 10:00:07 CET 2011


I made some progress (as I am now able to save a record to the database, but as soon 
as I the validation of one variable in the model:

/**
  * @var string
  * @validate EmailAddress
  */
protected $email;

and I fill in a wrong email address on purpose, I still get the InfiniteLoop problem.

The @dontvalidate is still there in the comments of the newAction() in the 
OrderController;

/*
  * Displays a form for creating a new order
  *
  * @param Tx_TravelPrograms_Domain_Model_Program $program The selected program
  * @param Tx_TravelPrograms_Domain_Model_Order $newOrder The new order object
  * @dontvalidate $newOrder
  * @return string An HTML form for creating a new order
  */
public function newAction(Tx_TravelPrograms_Domain_Model_Program $program, 
Tx_TravelPrograms_Domain_Model_Order $newOrder = NULL) {
	$referrals = $this->referralRepository->findAllReferrals();
	
	$this->view->assign('program', $program);
	$this->view->assign('newOrder', $newOrder);
	$this->view->assign('referrals', $referrals);
}

/*
  * @param Tx_TravelPrograms_Domain_Model_Program $program The selected program
  * @param Tx_TravelPrograms_Domain_Model_Order $newOrder A fresh newOrder object 
which has not been added to the repository yet
  * @return void
  */
public function createAction(Tx_TravelPrograms_Domain_Model_Order $newOrder) {
	$this->orderRepository->add($newOrder);
	$this->redirect('show');
}

I hope I'm not overlooking one of those silly typo's, as I can't see it :(

Regards, Mark

On 29/12/11 2:23 PM, Mark Kuiphuis wrote:
> Hi all,
>
> Some people have already written about this in the newsgroup before, but whatever I
> do, I cannot get rid of the InfiniteLoop problem.
>
> I am building a small extension where people can select one travel brochure
> ($program) at a time and then order that brochure. But whatever I do, I cannot get
> the order form to submit.
>
> It happens with TYPO3 4.5.10 (Extbase: 1.3.1-devel) and also with 4.6.2 (Extbase 1.4.1)
>
> <f:flashMessages /> also occasionally outputs over a 100 error messages like:
>
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->createAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
> An error occurred while trying to call
> Tx_TravelPrograms_Controller_OrderController->newAction()
>
> This happens after just clearing the cache and going through the process of ordering
> a travel brochure.
>
> My controller looks like this:
>
> <?php
> class Tx_TravelPrograms_Controller_OrderController extends
> Tx_Extbase_MVC_Controller_ActionController {
>
> /*
> * The referral Repository
> */
> public $referralRepository;
>
> /*
> * The orderRepository
> */
> public $orderRepository;
>
> /*
> * Initialises the repositories
> */
> public function initializeAction() {
> $this->referralRepository =
> t3lib_div::makeInstance('Tx_TravelPrograms_Domain_Repository_ReferralRepository');
> $this->orderRepository =
> t3lib_div::makeInstance('Tx_TravelPrograms_Domain_Repository_OrderRepository');
> }
>
> /*
> * Displays a form for creating a new order
> *
> * @param Tx_TravelPrograms_Domain_Model_Program $program The selected program
> * @param Tx_TravelPrograms_Domain_Model_Order $newOrder The new order object
> * @dontvalidate $newOrder
> * @return string An HTML form for creating a new order
> */
> public function newAction(Tx_TravelPrograms_Domain_Model_Program $program,
> Tx_TravelPrograms_Domain_Model_Order $newOrder = NULL) {
>
> $referrals = $this->referralRepository->findAllReferrals();
>
> $this->view->assign('program', $program);
> $this->view->assign('newOrder', $newOrder);
> $this->view->assign('referrals', $referrals);
> }
>
> /*
> * @param Tx_TravelPrograms_Domain_Model_Program $program The selected program
> * @param Tx_TravelPrograms_Domain_Model_Order $newOrder A fresh newOrder object which
> has not been added to the repository yet
> * @return void
> */
> public function createAction(Tx_TravelPrograms_Domain_Model_Program $program,
> Tx_TravelPrograms_Domain_Model_Order $newOrder) {
> $this->orderRepository->add($newOrder);
> $this->redirect('show');
> }
>
> /*
> * Just a comment...
> */
> public function showAction() {
> echo "ShowAction ---<br/>";
> }
> }
> ?>
>
> The @dontvalidate $newOrder is there, but I keep on getting this 101 infinite loop error
>
> The fluid form looks like this:
>
> <f:flashMessages />
>
> <f:form action="create" name="newOrder" object="{newOrder}" noCacheHash="true">
> <div>
> <f:form.hidden property="program" value="{program.uid}" />
> <f:form.hidden property="price" value="{program.price}" />
> </div>
> <div class="flabel">
> <label for="name"><f:translate key="name" /></label>
> </div>
> <div class="field"><f:form.textbox property="name" size="50" /></div>
>
> <div class="clear"></div>
>
> <div class="flabel">
> <label for="address"><f:translate key="address" /></label>
> </div>
> <div class="field"><f:form.textbox property="address" size="50" /></div>
>
> <div class="clear"></div>
>
> <div class="flabel">
> <label for="postcode"><f:translate key="postcode" /></label>
> </div>
> <div class="field"><f:form.textbox property="postcode" size="10" /></div>
>
> <div class="clear"></div>
>
> <div class="flabel">
> <label for="city"><f:translate key="city" /></label>
> </div>
> <div class="field"><f:form.textbox property="city" size="50" /></div>
>
> <div class="clear"></div>
>
> <div class="flabel">
> <label for="email"><f:translate key="email" /></label>
> </div>
> <div class="field"><f:form.textbox property="email" size="50" /></div>
>
> <div class="clear"></div>
>
> <!-- div class="flabel">
> <label for="newsletter"><f:translate key="newsletter" /></label>
> </div>
> <div class="field"><f:form.checkbox property="newsletter" value="0" /> <f:translate
> key="newsletter_info" /></div -->
>
> <div class="clear"></div>
>
> <div class="flabel">
> <label for="referral"><f:translate key="referral" /></label>
> </div>
> <div class="field"><f:form.select property="referral" options="{referrals}"
> optionValueField="uid" optionLabelField="title" /></div>
>
> <div class="clear"></div>
>
> <fieldset class="payment-methods">
> <legend><f:translate key="paymentTypes" /></legend>
> <div class="field">
> <f:form.radio class="radio" property="paymentType" value="1"
> checked="{payment.paymentType} == 1" /> <f:translate key="paymentType_Ideal" /><br/>
> <f:form.radio class="radio" property="paymentType" value="2"
> checked="{payment.paymentType} == 2" /> <f:translate key="paymentType_BankTransfer"
> /><br/>
> </div>
> </fieldset>
>
> <div class="clear"></div>
>
> <!-- div class="flabel"></div>
> <div class="field">
> <div style="float: left; margin-right: 5px;"><f:form.checkbox property="terms"
> value="1" /></div> <label for="terms-conditions"><f:translate key="terms-conditions"
> /></label>
> </div>
> <div class="field"><f:translate key="terms_info" /></div -->
>
> <div class="clear"></div>
>
> <f:form.submit class="submit" value="{f:translate(key: 'submit_order')}" />
> </f:form>
>
> And the model:
>
> <?php
> class Tx_TravelPrograms_Domain_Model_Order extends
> Tx_Extbase_DomainObject_AbstractEntity {
> /**
> * @var int
> */
> protected $program = 0;
>
> /**
> * @var double2
> */
> protected $price = 0.00;
>
> /**
> * @var string
> * @validate StringLength(maximum=5)
> */
> protected $name = '';
>
> /**
> * @var string
> */
> protected $address = '';
>
> /**
> * @var string
> */
> protected $postcode = '';
>
> /**
> * @var string
> */
> protected $city = '';
>
> /**
> * @var string
> */
> protected $email = '';
>
> /**
> * @var int
> */
> //protected $newsletter = 0;
>
> /**
> * @var int
> */
> protected $paymentType = '';
>
> /**
> * @var int
> */
> protected $referral = 0;
>
> /**
> * @var string
> */
> protected $transactionId = '';
>
> public function __construct($program = 0, $price = 0.00, $name = '', $address = '',
> $postcode = '', $city = '', $email = '', $paymentType = '', $referral = '',
> $transactionId = '') {
>
> $this->program = $this->setProgram($program);
> $this->price = $this->setPrice($price);
> $this->name = $this->setName($name);
> $this->address = $this->setAddress($address);
> $this->postcode = $this->setPostcode($postcode);
> $this->city = $this->setCity($city);
> $this->email = $this->setEmail($email);
> //$this->newsletter = $this->setNewsletter($newsletter);
> $this->paymentType = $this->setPaymentType($paymentType);
> $this->referral = $this->setReferral($referral);
> $this->transactionId = $this->setTransactionId($transactionId);
> }
>
> public function setProgram($program) {
> $this->program = (int)$program;
> }
>
> public function getProgram() {
> return $this->program;
> }
>
> public function setPrice($price) {
> $this->price = (double)$price;
> }
>
> public function getPrice() {
> return $this->price;
> }
>
> public function setName($name) {
> $this->name = (string)$name;
> }
>
> public function getName() {
> return $this->name;
> }
>
> public function setAddress($address) {
> $this->address = (string)$address;
> }
>
> public function getAddress() {
> return $this->address;
> }
>
> public function setPostcode($postcode) {
> $this->postcode = (string)$postcode;
> }
>
> public function getPostcode() {
> return $this->postcode;
> }
>
> public function setCity($city) {
> $this->city = (string)$city;
> }
>
> public function getCity() {
> return $this->city;
> }
>
> public function setEmail($email) {
> $this->email = (string)$email;
> }
>
> public function getEmail() {
> return $this->email;
> }
>
> // public function setNewsletter($newsletter) {
> // $this->newsletter = (int)$newsletter;
> // }
> //
> // public function getNewsletter() {
> // return $this->newsletter;
> // }
>
> public function setPaymentType($paymentType) {
> $this->name = (int)$paymentType;
> }
>
> public function getPaymentType() {
> return $this->paymentType;
> }
>
> public function setReferral($referral) {
> $this->referral = (int)$referral;
> }
>
> public function getReferral() {
> return $this->referral;
> }
>
> public function setTransactionId($transactionId) {
> $this->transactionId = (int)$transactionId;
> }
>
> public function getTransactionId() {
> return $this->transactionId;
> }
> }
> ?>
>
> I temporarily disabled the newsletter property as this is generating another error
> that no value could be found for key formObject...(don't know the exact error
> message)...
>
> Any help is kindly appreciated :-)
>
> Regards, Mark



More information about the TYPO3-project-typo3v4mvc mailing list