src/Database/Model/Relatable.php
public function hasMany($model, $options = array())
    {
        $options = static::getRelationInfo($model, $options);

        if (!isset($options['localKey'])) {
            $options['localKey'] = static::primaryKey();
        }

        if (!isset($options['foreignKey'])) {
            $options['foreignKey'] = Inflector::foreignKey(static::table());
        }

        return $options['model']::select()
            ->where("{$options['foreignKey']} = ?", $this->{$options['localKey']})
            ->mergeNextWhere();
    }
public function hasMany($model, $options = array())
    {
        $options = static::getRelationInfo($model, $options);

        if (!isset($options['localKey'])) {
            $options['localKey'] = static::primaryKey();
        }

        if (!isset($options['foreignKey'])) {
            $options['foreignKey'] = Inflector::foreignKey(static::table());
        }

        return $options['model']::select()
            ->where("{$options['foreignKey']} = ?", $this->{$options['localKey']})
            ->mergeNextWhere();
    }
public function hasMany ( $ model , $ options = array ( ) ) { $ options = static :: getRelationInfo ( $ model , $ options ) ; if ( ! isset ( $ options [ 'localKey' ] ) ) { $ options [ 'localKey' ] = static :: primaryKey ( ) ; } if ( ! isset ( $ options [ 'foreignKey' ] ) ) { $ options [ 'foreignKey' ] = Inflector :: foreignKey ( static :: table ( ) ) ; } return $ options [ 'model' ] :: select ( ) -> where ( "{$options['foreignKey']} = ?" , $ this -> { $ options [ 'localKey' ] } ) -> mergeNextWhere ( ) ; }
Returns an array of owned objects.

@param string $model   Name of the model.
@param aray   $options Optional relation options.

@return array
Returns an array of owned objects .