Anonyme Funktionen

6. November 2011
/* Definition von Spalten in einem CGridView,
 * beide tun dasselbe,
 * nur ist das mit dieser anonymous function irgendwie eleganter in PHP 5.3
 */
 
'columns' => array(
    array(
        'name' => 'name',
        'type' => 'html',
        'value' => function($data) {
            return CHtml::link($data->name, array('company/view', 'companySlug' => $data->slug));
        }
    ),
    array(
        'class' => 'CLinkColumn',
        'labelExpression' => '$data->name',
        'urlExpression' => "array('company/view', 'companySlug' => \$data->slug)"
    )
)
Author: Categories: Allgemein, Yii Tags: ,

Bootstrap, from Twitter

26. September 2011
Author: Categories: Yii Tags:

Drei Links

23. September 2011
Author: Categories: Yii Tags:

Liefert Posts einer Kategorie über Many_Many_Relation

12. September 2011
//table post (id, title)
//table category (id, name)
//table post_category (postId, categoryId)
 
//class Post extends CActiveRecord
public function relations()
{
    return array(
        'categories' => array(self::MANY_MANY, 'Category', 'tbl_post_category(postId, categoryId)')
    );
}
 
public function search($category)
{
    $criteria = new CDbCriteria;
 
    $criteria->with = array(
        'categories' => array(
            'condition' => 'categories.id = :categoryId',
            'params' => array(':categoryId' => $category->id),
            'together' => true
        )
    );
 
    return new CActiveDataProvider('Posts', array(
        'criteria' => $criteria,
    ));
}
Author: Categories: Yii Tags:

Wie Yii entwickelt wird

11. September 2011
Author: Categories: Yii Tags:

yiiframework – Guidelines for good schema design

9. September 2011

Ich hätte es nicht besser niederschreiben können, deswegen hier der Verweis auf best practice.

Author: Categories: Yii Tags: , , ,

phploc yiiframework 1.1.8

6. September 2011
C:\Users\mbischof\projects>phploc framework
phploc 1.6.1 by Sebastian Bergmann.
 
Directories:                                        161
Files:                                             1406
 
Lines of Code (LOC):                             334619
  Cyclomatic Complexity / Lines of Code:           0.04
Comment Lines of Code (CLOC):                     47700
Non-Comment Lines of Code (NCLOC):               286919
 
Namespaces:                                           0
Interfaces:                                          28
Classes:                                            625
  Abstract:                                          53
  Concrete:                                         572
  Average Class Length (NCLOC):                     125
Methods:                                           4354
  Scope:
    Non-Static:                                    4021
    Static:                                         333
  Visibility:
    Public:                                        3353
    Non-Public:                                    1001
  Average Method Length (NCLOC):                     17
  Cyclomatic Complexity / Number of Methods:       3.41
 
Anonymous Functions:                                  0
Functions:                                            0
 
Constants:                                          199
  Global constants:                                  46
  Class constants:                                  153
Author: Categories: Yii Tags: