Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthormasylum
     
    Hey,
    I have some problems handling null fields in Akelos. Maybe you can help me!

    Installers:
    How can I determine the type of a field in a installer / if a field is allowed to have null values / the default value?

    Models:
    I have this validation in my User model. I want to validate description length if there is a description. I found in the docs that there is an allow_null but it doesn't work to me, what I'm missing?. Anyways, an allow_blank would be great.

    models/User.rb
    $this->validatesLengthOf('description', array('within' => explode(',', LONG_STRING_LENGTH), 'allow_null' => true));

    tests/User.rb
    $user->description = null;
    $this->assertTrue($user->isValid());
    • CommentAuthorinsanet
     

    mmm, not pretty sure if this is what you want, but anyways here it is: this is what akelos use -> ADOdb Data Dictionary :

      http://phplens.com/lens/adodb/docs-datadict.htm
    

    and this the Editam installer that you can take as example:

     http://trac.editam.com/browser/trunk/src/includes/editam/installers/editam_installer.php
    
    • CommentAuthormasylum
     
    Thank's insanet, Editam example answered my installer doubt!

    I 'solved' the missing allow_blank issue with this trick:

    if(!empty($this->description)){
    $this->validatesLengthOf('description', array('within' => explode(',', LONG_STRING_LENGTH)));
    }