library/Garp/Spawn/Behavior/Set.php
protected function _addWeighableBehavior() {
        $model = $this->getModel();
        $weighableRels = $model->relations->getRelations('weighable', true);

        if (!$weighableRels) {
            return;
        }

        $weighableConfig = array();

        foreach ($weighableRels as $relName => $rel) {
            $weightColumn = Garp_Spawn_Util::camelcased2underscored($relName) . '_weight';
            $weighableConfig[$relName] = array(
                'foreignKeyColumn' => $rel->column,
                'weightColumn'     => $weightColumn
            );
        }

        $this->_add('relation', 'Weighable', $weighableConfig);
    }
protected function _addWeighableBehavior() {
        $model = $this->getModel();
        $weighableRels = $model->relations->getRelations('weighable', true);

        if (!$weighableRels) {
            return;
        }

        $weighableConfig = array();

        foreach ($weighableRels as $relName => $rel) {
            $weightColumn = Garp_Spawn_Util::camelcased2underscored($relName) . '_weight';
            $weighableConfig[$relName] = array(
                'foreignKeyColumn' => $rel->column,
                'weightColumn'     => $weightColumn
            );
        }

        $this->_add('relation', 'Weighable', $weighableConfig);
    }
protected function _addWeighableBehavior ( ) { $ model = $ this -> getModel ( ) ; $ weighableRels = $ model -> relations -> getRelations ( 'weighable' , true ) ; if ( ! $ weighableRels ) { return ; } $ weighableConfig = array ( ) ; foreach ( $ weighableRels as $ relName => $ rel ) { $ weightColumn = Garp_Spawn_Util :: camelcased2underscored ( $ relName ) . '_weight' ; $ weighableConfig [ $ relName ] = array ( 'foreignKeyColumn' => $ rel -> column , 'weightColumn' => $ weightColumn ) ; } $ this -> _add ( 'relation' , 'Weighable' , $ weighableConfig ) ; }
Adds the weighable behavior, for user defined sorting of related objects.
Can only be initialized after the relations for this model are set.

@return void
Adds the weighable behavior for user defined sorting of related objects . Can only be initialized after the relations for this model are set .