Posts Tagged ‘Symfony’

Class ‘Array’ not found error when using sfCombineFilterPlugin in Symfony 1.0.x

Wednesday, March 4th, 2009 by The BCM Team

If you are getting a “Class ‘Array’ not found” error when using sfCombineFilterPlugin then a quick fix would be to make the “filters.yml” file look like the following:


rendering: ~
web_debug: ~
security:  ~
# generally, you will want to insert your own filters here
cache:     ~
common:    ~
sfCombineFilter:
  class:   sfCombineFilter
    #param:
    #condition:
flash:     ~
execution: ~

What I did was comment out the param: and condition: lines.

Setting up Symfony to use Exim instead of Sendmail

Sunday, February 1st, 2009 by The BCM Team

By default Symfony uses Sendmail mail transfer agent to prepare emails to be sent out by the system. If you want to use Exim instead,you need to:

  1. Install Exim to your system – please see my Exim on CentOs 4/5
  2. Configure Symfony to use Exim instead of SendmailEdit (or create if it does not exists) /apps/--app name--/config/mailer.yml and add the following to it:
    
    dev:
      deliver: on
      hostname: mail.yourmailhost.com
      port: 25
    all:
      mailer: exim
    

    Here we are setting Exim to be the default mail agent for all environments plus defining SMTP host name and port for the dev environment.

Symfony Notice: Undefined offset: 0 in /symfony/util/Spyc.class.php

Monday, January 26th, 2009 by The BCM Team

If you are getting an above notice in Symfony (especially after you clear cache) check your yml files. You are most likely missing a colon somewhere or have some other error.

For example:


setting
  id1: value1
  id2: value2

should be (missing colon):


setting:
  id1: value1
  id2: value2

Null and Not Null in Propel queries

Sunday, January 4th, 2009 by The BCM Team

Here is a quick hint on how to use Propel and its Criteria class to generate queries that need to have Null or Not Null in WHERE clauses:


<?php
$c = new Criteria();
$c->add(TablePeer::TABLE_ID, null, Criteria::NOT_EQUAL);

// this is the same as above
$c = new Criteria();
$c->add(TablePeer::TABLE_ID, null, Criteria::ISNOTNULL);

// ======================================

// for equality checking do this:
$c = new Criteria();
$c->add(TablePeer::TABLE_ID, null);

// or
$c = new Criteria();
$c->add(TablePeer::TABLE_ID, null, Criteria::EQUAL);

// or
$c = new Criteria();
$c->add(TablePeer::TABLE_ID, null, Criteria::ISNULL);

?>

Symfony: Ajax.Autocompleter is not a constructor

Sunday, January 4th, 2009 by The BCM Team

If you use Symfony and its Autocomletion feature, you may get the following error: "Ajax.Autocompleter is not a constructor"
There could be two reasons for this:

  1. Necessary JS libraries are not loaded. To fix make sure you load the following libraries (example below is for including them from the action):
    
    $response->addJavascript('/sf/js/prototype/prototype');
    $response->addJavascript('/sf/js/prototype/effects');
    $response->addJavascript('/sf/js/prototype/controls');
    
    
  2. You could be including Prototype JS library twice. So for the example above I am adding a prototype JS library. In addition to that I could have added it to be added in the view.yml file. This would have caused the "Ajax.Autocompleter is not a constructor".

Convert Propel object to Array

Tuesday, May 13th, 2008 by The BCM Team

To convert a Propel object (a database row representation) to a normal array use the following:
$member->toArray(), where $member is a propel object.