Showing posts with label symfony1. Show all posts
Showing posts with label symfony1. Show all posts

Custom symfony error pages for 404 and 500 errors

500 error page
- Since symfony 1.2 your error page must be stored as error.html.php in the folder /config/errors/
- Default file:/lib/vendor/symfony/lib/exception/data/error.html.php
Available variables:  (một số biến được dùng trong file error)
- $exception: The exception.
- $code: The status code. Defaults to 500 but might have been replaced by $response->getStatusCode().
- $text: The status text. Defaults to “Internal server error” but might have been replaced by $response->getStatusText().
- $format: The request format. Defaults to “html” but might have been replaced by $response->getRequestFormat().

symfony execute raw query with doctrine

$query = ‘INSERT INTO table_name (`field1`, `field2 `, `content`, `created_at`) values ‘ ….

$conn = Doctrine_Manager::connection();
$pdo = $conn->execute($query);

Enable logging in the Symfony production environment

To enable symfony logging edit the file apps/frontend/config/settings.yml
prod:
  .settings:
    logging_enabled:        on
edit apps/frontend/config/factories.yml
prod:
  logger:
    class: sfAggregateLogger
    param:
      level: debug