views:

36

answers:

1

Hi,

I've just come across the Star Schema for Report-Aggregation. The first Question that came to my mind is whether or not Doctrine ORM supports such denormalized Tables. As I've seen ist, there are a feww kinky behaiviours in dealing with relations, a Model could not completely know.

Any ideas? Is it possible?

A: 

Did you mean something like:

// models/Phonenumber.php

class Phonenumber extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->hasColumn('user_id', 'integer', null, array(
                'type' => 'integer'
            )
        );

        $this->hasColumn('phonenumber', 'string', 255, array(
                'type' => 'string',
                'length' => '255'
            )
        );
        $this->hasColumn('primary_num', 'boolean');
    }

    public function setUp()
    {
        $this->hasOne('User', array(
                'local' => 'user_id',
                'foreign' => 'id'
            )
        );
    }
}

// models/Group.php

class Group extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('groups');
        $this->hasColumn('name', 'string', 255, array(
                'type' => 'string',
                'length' => '255'
            )
        );
    }

    public function setUp()
    {
        $this->hasMany('User as Users', array(
                'refClass' => 'UserGroup',
                'local' => 'group_id',
                'foreign' => 'user_id'
            )
        );
    }
}

This was taken from: link text

within the setUp you tell the model which other model and how it referes to.

ITroubs
no, I already have a Doctrine App up and running, its not about basics. What I mean is http://en.wikipedia.org/wiki/Star_schema, and whether a highly denormalized Table Structure can be joined using Doctrine, because I search for a way out of Reporting hell...
FloydThreepwood