[symfony-users] Re: what would suppress a fatal error so it does not appear in the error log?

2009-10-24 Thread larry

Thanks, Lee. I've used sfErrorHandlerPlugin on other projects, but not
yet this one. I'll install it tonight.


On Oct 24, 7:13 am, Lee Bolding  wrote:
> If you search the mailing list archives, there are plenty of instances  
> where I've talked about this before...
>
> Usually, it's caused when a type-cast arg is required by a function,  
> and the incorrect type of arg is supplied...
>
> EG
>
> public function addComment(Comment $comment)
>
> Where addComment is expecting a Comment object, but for some reason or  
> another it gets supplied something else (most commonly NULL or FALSE,  
> because a previous call to retrieve or create the Comment object  
> returned NULL/FALSE).
>
> If you use sfErrorHandlerPlugin, it can catch most of these errors for  
> you
>
> On 24 Oct 2009, at 02:35, larry wrote:
>
>
>
> > My site seems to be dying on this line:
>
> > 
>
> > I look in the error log and I find no fatal error, only errors and
> > warnings, none fatal. What could suppress a fatal error so it doesn't
> > show up in the error log?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: what would suppress a fatal error so it does not appear in the error log?

2009-10-24 Thread larry



On Oct 23, 11:41 pm, Eno  wrote:
> On Fri, 23 Oct 2009, larry wrote:
> > Seems to be working now. Not sure what happened. I rebuilt the model,
> > the forms, and cleared the cache, and now it works. But it is very odd
> > that there was no error in the error log, nor on screen.
>
> Im guessing that clearing the cache helped :-)


No, I ran "symfony cc" many, many times. And then I worried that
perhaps PHP lacked the permissions needed to clear the cache (I was
moving files to a new location on the server) so I chmod everything to
0777. And then I cd'ed  to cache and manually deleted everything. That
had no effect. But somehow rebuilding the model helped. Possibly a
base file got lost in transit, though I'd expect to see an error,
somewhere, if that happened.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: what would suppress a fatal error so it does not appear in the error log?

2009-10-24 Thread Eno

On Sat, 24 Oct 2009, Lee Bolding wrote:

> Where addComment is expecting a Comment object, but for some reason or  
> another it gets supplied something else (most commonly NULL or FALSE,  
> because a previous call to retrieve or create the Comment object  
> returned NULL/FALSE).
> 
> If you use sfErrorHandlerPlugin, it can catch most of these errors for  
> you

What I do is code defensively: check an object is not null before trying 
to use it.


-- 



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] What's the best way to suppress redirects in the admin generator for ajax actions?

2009-10-24 Thread ashton

Hi!
I have a "wizard" in my admin generator that ajax posts to multiple
different modules to step the user through creating objects in the
correct order.

I'm using the generated actions, so I post to (in one example)
"facility/create" and the object is created.  Works like a charm,
except that there is no feedback.
I'm having some trouble determining how to build the response.  The
generated executeCreate action calls processForm, and processForm is
hardcoded to redirect to facility/edit if the insertion is
successful.  This is not the behavior that I want when I'm using
ajax.  I just want a little JSON back.

I could override processForm(), or redirect() in all the actions, but
that seems like too much redundant code (I'm creating objects like
this in several modules).  It seems as if there should be some good
way to suppress or block the redirect.

Is there a good way to keep processForm from redirecting to the edit
page?
and/or
Is there a better way to accomplish the ajax creates?

thanks!

class facilityActions extends autoFacilityActions
{
//I can't do this because processForm redirects.
public function executeCreate(sfWebRequest $request) {
parent::executeCreate($request);
if($isAjax = $this->getRequest()->isXmlHttpRequest()) {
return $this->renderText(json_encode(array
('status'=>'error')));
}
}
}

class autoFacilityActions extends sfAction
{
  protected function processForm(sfWebRequest $request, sfForm $form)
  {
$form->bind($request->getParameter($form->getName()), $request-
>getFiles($form->getName()));
if ($form->isValid())
{
  $notice = $form->getObject()->isNew() ? 'The item was created
successfully.' : 'The item was updated successfully.';

  $facility = $form->save();

  $this->dispatcher->notify(new sfEvent($this,
'admin.save_object', array('object' => $facility)));

  if ($request->hasParameter('_save_and_add'))
  {
$this->getUser()->setFlash('notice', $notice.' You can add
another one below.');

$this->redirect('@facility_new');
  }
  else
  {
$this->getUser()->setFlash('notice', $notice);

$this->redirect(array('sf_route' => 'facility_edit',
'sf_subject' => $facility));
  }
}
else
{
  $this->getUser()->setFlash('error', 'The item has not been saved
due to some errors.', false);
}
  }

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[symfony-users] Re: what would suppress a fatal error so it does not appear in the error log?

2009-10-24 Thread Lee Bolding

If you search the mailing list archives, there are plenty of instances  
where I've talked about this before...

Usually, it's caused when a type-cast arg is required by a function,  
and the incorrect type of arg is supplied...

EG

public function addComment(Comment $comment)

Where addComment is expecting a Comment object, but for some reason or  
another it gets supplied something else (most commonly NULL or FALSE,  
because a previous call to retrieve or create the Comment object  
returned NULL/FALSE).

If you use sfErrorHandlerPlugin, it can catch most of these errors for  
you

On 24 Oct 2009, at 02:35, larry wrote:

>
>
> My site seems to be dying on this line:
>
> 
>
>
> I look in the error log and I find no fatal error, only errors and
> warnings, none fatal. What could suppress a fatal error so it doesn't
> show up in the error log?
>
> >


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---