Actually, I find now that there is one database table, the "alumni"
module, where the problem is consistent. It will not fill in forms
with their values. If I go to an URL like this:

frontend_dev.php/newcoach/edit/id/194

I get a form with no values filled in. This is what I have in
actions.class.php:

  public function executeEdit($request)
  {
    $this->form = new AlumniForm(AlumniPeer::retrieveByPk($request-
>getParameter('id')));
  }

The template is the auto-generated editSuccess.php

The debug tool bar shows me these queries:


prepareStatement(): SELECT alumni.ID, alumni.NAME, alumni.DESCRIPTION,
alumni.TIMEPERIOD, alumni.HIGHSCHOOL, alumni.HIGHSCHOOLDESC,
alumni.COLLEGE1, alumni.COLLEGE1DESC, alumni.COLLEGE2,
alumni.COLLEGE2DESC, alumni.IMAGE, alumni.HASBIO,
alumni.ISALUMNIPROJECT, alumni.ISCOMMUNITYSERVICE,
alumni.ISHIGH5BUDDY, alumni.ISRECCOACH, alumni.ISCONTRIBUTOR,
alumni.ISSPONSOR, alumni.NEW_PLAYER_ID, alumni.NEW_LOCATION_ID FROM
alumni WHERE alumni.ID=?


executeQuery(): [1.54 ms] SELECT alumni.ID, alumni.NAME,
alumni.DESCRIPTION, alumni.TIMEPERIOD, alumni.HIGHSCHOOL,
alumni.HIGHSCHOOLDESC, alumni.COLLEGE1, alumni.COLLEGE1DESC,
alumni.COLLEGE2, alumni.COLLEGE2DESC, alumni.IMAGE, alumni.HASBIO,
alumni.ISALUMNIPROJECT, alumni.ISCOMMUNITYSERVICE,
alumni.ISHIGH5BUDDY, alumni.ISRECCOACH, alumni.ISCONTRIBUTOR,
alumni.ISSPONSOR, alumni.NEW_PLAYER_ID, alumni.NEW_LOCATION_ID FROM
alumni WHERE alumni.ID=225


When I run this second query in phpMyAdmin, it correctly gets the
values for this entry.







On Feb 16, 1:31 am, Lawrence Krubner <lkrub...@geocities.com> wrote:
> I am getting an intermittent error. I'm having trouble debugging it,
> because it is intermittent. Sometimes it manifests as a fatal error
> due to the maximum amount of memory being overrun. Other times it
> manifests as forms not filling in with the values they should have,
> even when editing an old entry. And this is with code that, for the
> most part, is unmodified auto-generated Propel crud templates and
> actions.class.php.
>
> Symfony: 1.1.4
>
> PHP: 5.2
>
> The server is an old Sun workstation now running Ubuntu Linux.
>
> To take one particular case, I generated a module with this command:
>
> symfony propel:generate-crud frontend writeup Writeup
>
> I generated 27 modules in this way (I've been hired to rebuild an old
> site as a Symfony site.)
>
> If I go to the list view:
>
> frontend_dev.php/writeup/index
>
> then all is good. But if I try to visit any one particular item with a
> url such as this:
>
> frontend_dev.php/writeup/edit/id/8
>
> The form is empty. I don't know why. If I try to debug by putting this
> in editSuccess.php:
>
> <?php print_r($form) ?>
>
> Then I get a Fatal error from a memory over use error.
>
> I face the same problem with the alumni module:
>
> In my actions class, I have this:
>
>   public function executeEdit($request)
>   {
>     $this->form = new 
> AlumniForm(AlumniPeer::retrieveByPk($request->getParameter('id')));
>
>   }
>
> In editSuccess, I have this:
>
> <?php $alumni = $form->getObject() ?>
> <h1><?php echo $alumni->isNew() ? 'New' : 'Edit' ?> Alumni</h1>
>
> <form action="<?php echo url_for('alumni/update'.(!$alumni->isNew() ?
> '?id='.$alumni->getId() : '')) ?>" method="post" <?php $form->isMultipart() 
> and print 'enctype="multipart/form-data" ' ?>>
>
>   <table>
>     <tfoot>
>       <tr>
>         <td colspan="2">
>           &nbsp;<a href="<?php echo url_for('alumni/index') ?>">Cancel</a>
>
>           <?php if (!$alumni->isNew()): ?>
>             &nbsp;<?php echo link_to('Delete', 'alumni/delete?id='.
> $alumni->getId(), array('post' => true, 'confirm' => 'Are you
> sure?')) ?>
>           <?php endif; ?>
>           <input type="submit" value="Save" />
>         </td>
>       </tr>
>     </tfoot>
>     <tbody>
>       <?php echo $form->renderGlobalErrors() ?>
>       <tr>
>         <th><?php echo $form['name']->renderLabel() ?></th>
>         <td>
>           <?php echo $form['name']->renderError() ?>
>           <?php echo $form['name'] ?>
>         </td>
>       </tr>
>       <tr>
>         <th><?php echo $form['description']->renderLabel() ?></th>
>         <td>
>           <?php echo $form['description']->renderError() ?>
>           <?php echo $form['description'] ?>
>         </td>
>       </tr>
>       <tr>
>         <th><?php echo $form['new_location_id']->renderLabel() ?></th>
>         <td>
>           <?php echo $form['new_location_id']->renderError() ?>
>           <?php echo $form['new_location_id'] ?>
>
>         <?php echo $form['id'] ?>
>         </td>
>       </tr>
>     </tbody>
>   </table>
> </form>
>
> Again, this is default, auto-generated code. It either doesn't work or
> I get a Fatal error.
>
> I added primary keys late in this process. This particular database
> was built by another programmer, years ago. That programmer did not
> give the database table a primary key. I added that. I just had the
> thought that maybe the primary key hadn't been captured in the auto-
> generated schema, but apparently it was:
>
>  alumni:
>     _attributes: { idMethod: native }
>     id: { type: INTEGER, required: true, autoIncrement: true,
> primaryKey: true }
>     Name: { type: VARCHAR, size: '75' }
>     Description: { type: VARCHAR, size: '255' }
>     TimePeriod: { type: VARCHAR, size: '25' }
>     HighSchool: { type: VARCHAR, size: '100' }
>     HighSchoolDesc: { type: LONGVARCHAR }
>     College1: { type: VARCHAR, size: '100' }
>     College1Desc: { type: LONGVARCHAR }
>     College2: { type: VARCHAR, size: '100' }
>     College2Desc: { type: LONGVARCHAR }
>     Image: { type: VARCHAR, size: '50' }
>     HasBio: { type: CHAR, size: '1', required: true, default: F }
>     IsAlumniProject: { type: CHAR, size: '1', required: true, default:
> F }
>     IsCommunityService: { type: CHAR, size: '1', required: true,
> default: F }
>     IsHigh5Buddy: { type: CHAR, size: '1', required: true, default:
> F }
>     IsRecCoach: { type: CHAR, size: '1', required: true, default: F }
>     IsContributor: { type: CHAR, size: '1', required: true, default:
> F }
>     IsSponsor: { type: CHAR, size: '1', required: true, default: F }
>     new_player_id: { type: INTEGER, required: true, default: '' }
>     new_location_id: { type: INTEGER, required: true, default: '' }
>
> As an experiment, I added this to the top of the editSuccess.php
> template:
>
> <?php
> $something = $form['name'];
> echo " here is something: ";
> print_r($something);
> ?>
>
> Then I suddenly started getting this error:
>
> Fatal error: Allowed memory size of 134217728 bytes exhausted (tried
> to allocate 50196481 bytes) in /home/lawrence/public_html/bocahoops/
> apps/frontend/templates/layout.php on line 243
>
> When I open up layout.php and look at line 243, I see it is simply
> this:
>
> <?php echo $sf_content ?>
>
> Can anyone explain to me why that line would cause the software to try
> to allocate 50 megs of RAM?
>
> So, for the individual edit forms, this is the kind of SQL being
> generated:
>
> SELECT alumni.ID, alumni.NAME, alumni.DESCRIPTION, alumni.TIMEPERIOD,
> alumni.HIGHSCHOOL, alumni.HIGHSCHOOLDESC, alumni.COLLEGE1,
> alumni.COLLEGE1DESC, alumni.COLLEGE2, alumni.COLLEGE2DESC,
> alumni.IMAGE, alumni.HASBIO, alumni.ISALUMNIPROJECT,
> alumni.ISCOMMUNITYSERVICE, alumni.ISHIGH5BUDDY, alumni.ISRECCOACH,
> alumni.ISCONTRIBUTOR, alumni.ISSPONSOR, alumni.NEW_PLAYER_ID,
> alumni.NEW_LOCATION_ID FROM alumni WHERE alumni.ID=233
>
> When I copy and paste this to phpMyAdmin, it works fine.
>
> I worked late last night, but the forms wouldn't work. Several times I
> tried to clear the cache:
>
> php symfony cc
>
> No effect.
>
> I went off to bed without able to figure out a solution. I came back
> to work today and everything is working fine. The forms fill and, so
> far, no fatal errors.
>
> Can anyone think what would cause such an intermittent bug? Perhaps
> something to do with sessions?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to