Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Monday, June 11, 2012

List Form Errors in Symfony

<?php if( $form->hasErrors() || $form->hasGlobalErrors() ) : ?>
  
    <?php foreach( $form->getGlobalErrors() as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php $errors = $form->getErrorSchema()->getErrors() ?> <?php if ( count($errors) > 0 ) : ?> <?php foreach( $errors as $name => $error ) : ?>
  • <?php echo $name ?> : <?php echo $error ?>
  • <?php endforeach; ?> <?php endif; ?>
<?php endif; ?>

Friday, March 23, 2012

Solved: Chrome Error 139 (net::ERR_TEMPORARILY_THROTTLED)

  1. Open: chrome://net-internals/#httpThrottling
  2. Uncheck the checkbox.
  3. Be happy ASAP.

Thursday, April 21, 2011

Form Validation Errors At Top of the Page in Symfony

    <?php foreach($form->getWidgetSchema()->getPositions() as $widgetName): ?> <?php if($form[$widgetName]->hasError()): ?>
  • <?php echo $form[$widgetName]->renderLabelName().': '.__($form[$widgetName]->getError()->getMessageFormat()); ?>
  • <?php endif; ?> <?php endforeach; ?>

Monday, April 18, 2011

Show HTML Tags Instead of Entities in Flash Messages in Symfony

Use this instead:
$sf_user->getFlash('msg', ESC_RAW);

Friday, October 29, 2010

SQLSTATE[HY000]: General error: 1005 Can't create table

Let's see a very simple CORRECT relation and reasons why it can throw SQLSTATE[HY000]: General error...

relations:
    User:
      foreignAlias: Phonenumbers
      local: user_id
      foreign: id
      type: one
      foreignType: many

  1. Did you forget to define the user_id field in the Phonenumber table?
  2. Did you check the type of the user_id field and the Phonenumber table's id field? They must be exactly the same integer. If one of them is int(4) and the other is int(8), the building will fail.

Wednesday, October 13, 2010

_csrf_token [CSRF attack detected.] error using sfAdminThemejRollerPlugin

If you try to do a batch delete with the Choose an option form, you can get a CSRF attack detection error using the sfAdminThemejRollerPlugin 0.2.0beta plugin.


Solution:
  1.  Edit plugins/sfAdminThemejRollerPlugin/data/generator/sfDoctrineModule/jroller/template/templates/_list_batch_actions.php and change line 9 from:

    [?php $form = new sfForm(); if ($form->isCSRFProtected()): ?]

    to:

    [?php $form = new BaseForm(); if ($form->isCSRFProtected()): ?]
  2. Edit plugins/sfAdminThemejRollerPlugin/data/generator/sfDoctrineModule/jroller/parts/batchAction.php and change line 29 from:

    $validator = new sfValidatorDoctrineChoice(array('model' => '<?php echo $this->getModelClass() ?>'));

    to:

    $validator = new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => '<?php echo $this->getModelClass() ?>'));
  3. Type symfony cc to clear the cache.

Wednesday, September 1, 2010

How to Manage MySQL Table Names with #__ Prefix

Every time you make a query from a table that has a special #__ prefix, you need to put table name between `` signs.
INSERT INTO `#__session` ...
Otherwise it won't work and give you a meaningless error:

MySQL query error, please check your configuration! You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Wednesday, August 25, 2010

sfDoctrinePager: Fatal error: Call to undefined method Doctrine_Collection::offset()

If you set a sfDoctrinePager object and give an EXECUTED query to the $this->pager->setQuery() method, you get a fatal error. Don't forget, sfDoctrinePager will execute the query, not you. Remove the ->execute() command from the end of the query.

Fatal error: Call to undefined method Doctrine_Collection::offset() in C:\webserv\www\phpcrm\lib\vendor\symfony\lib\plugins\sfDoctrinePlugin\lib\pager\sfDoctrinePager.class.php on line 84

Thursday, August 12, 2010

Old Nusoap Syntax can cause SOAP Error in PHP5

It is related to PHP5, which object names collides with the new soapclient() syntax (the PHP SOAP extension uses the same object name). If you change your syntax in the constructor from "new soapclient()" to "new nusoap_client()", the collision won't happen - and everything will be happy. Nusoap keeps the old syntax for legacy support ("new soapclient"). But PHP5 won't like it and give you a nice error:

Warning: SoapClient::SoapClient() expects parameter 2 to be array, boolean
given in /var/www/userdetails.php
on line 76

Fatal error: Uncaught SoapFault exception: [Client]
SoapClient::SoapClient() [soapclient.soapclient]: Invalid
parameters in
/var/www/userdetails.php:76 Stack
trace: #0
/var/www/userdetails.php(76):
SoapClient->SoapClient('https://195.228...', true) #1
/var/www/index.php(48): include('/var/www/i...') #2
{main} thrown in
/var/www/userdetails.php on line 76