propel 1.5

28/12/2009

propel 1.5 has been announced. There’s some exciting new features, see http://propel.phpdb.org/trac/wiki/Users/Documentation/1.5/WhatsNew

I’m particularly looking forward to playing with the new ModelCriteria class. I think this will ultimately simplify the way we query the db, though it may take a bit of getting used to at first.

new symfony release, it’s close!

27/11/2009

http://www.symfony-project.org/tutorial/1_4/en/whats-new

My favourite is the new mailer component, based on Swift Mailer – very flexible.

My second favourite is the sfForm::useFields() method. No more calls to unset($this[<widget_name>]) in sfForm::configure()

propel 1.4 stable release

10/11/2009

Just a quickie: propel 1.4 stable is now released! This is available in the upcoming symfony 1.3 release. Our team have been running with 1.4 branch of propel for 2-3 months now and found it very stable. Give it a try.

This will be the default version of propel in symfony 1.3 (release date Dec 2009)

tips for php coding in netbeans

30/10/2009

I’ve switched from Vim to netbeans in the past 9 months or so – I’ve been using Vim for 5+ years before that and finding an editor to beat it wasn’t easy. Main aim was to get better code completion, plus whichever editor I used had to have ‘hippie search‘  – this speeds up coding no end. Tried eclipse PDT along the way but found that too slow.

Ultimately netbeans persuaded me to convert. Here are some tips for using it:

General tips

  • Use at least 6.8 beta version of netbeans – there are performance improvements for code completion which increase code completion a lot. If you’ve tried 6.7/6.5 – try again with the 6.8 beta+, especially with large projects.
  • Enable hippie search – The default keys are ctrl+k and ctrl+shift+k – If you’re a Vim person, change these to ctrl+p and ctrl+n. The ‘Actions’ in the keymap editor are ‘Next matching word’ and ‘Previous matching word’
  • Initiate code completion manually – use ctrl+space (default) I find the auto code completion popup just gets in the way. YMMV.
  • Use Navigate menu – this allows you to find files/classes/functions/methods in your code almost instantly
  • phpdoc your code: this allows code completion to work in places it otherwise could not

Symfony

  • Ignore ‘test’ directories – make sure you ignore certain dirs in symfony. This makes code completion ignore classes under those directories.  I have problems with it picking up classes not in our project e.g. sfContext can get confused with sfContextMock from the tests.
  • Symfony is supported in netbeans 6.8M2+ see http://blogs.sun.com/netbeansphp/entry/initial_symfony_support

netbeans php code completion speed

22/10/2009

If you’ve suffered slow netbeans code completion speeds in the past, you should look at the latest dev build

Code completion is much quicker – instead of the 4-5 seconds it used to take, it’s now almost instant on a large php project with approx. 12,000 files (including symfony framework)

Add MAXLENGTH attribute to sfWidgetFormInput

11/10/2009

One oversight of symfony is that it does not add the MAXLENGTH attribute to the sfWidgetFormInput/sfWidgetFormInputText widget even though it knows the max length for a validator. For Propel (Doctrine too?), symfony 1.2/1.3 allows you to override the setup in BaseFormPropel in lib\form\BaseFormPropel.class.php. Overriding setup() allows you to add the MAXLENGTH attribute based on the validator.

public function setup() {
  parent::setup();
  foreach ($this->getWidgetSchema()->getFields() as $name => $widget)
  {
    $classname = get_class($widget);
    if ($classname == 'sfWidgetFormInputText') {
      if (($val = $this->getValidator($name)) && ($len = $val->getOption('max_length'))) {
        $widget->setAttribute('maxlength', $len);
      }
    }
  }
}

Follow

Get every new post delivered to your Inbox.