hobodave (owner)

Revisions

gist: 225647 Download_button fork
public
Public Clone URL: git://gist.github.com/225647.git
Embed All Files: show embed
fixtures.yml #
1
2
3
4
5
6
7
8
9
10
11
Ticket:
  fooTicket:
    details: Stuff
  barTicket:
    details: Other Stuff
 
TicketsMm:
  fooTicketMm:
    Ticket: fooTicket
  barTicketMm:
    Ticket: barTicket
Ticket.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
 
class Ticket extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('tickets');
        $this->hasColumn('id', 'integer', 4, array(
            'primary' => true,
            'notnull' => true,
            'autoincrement' => true
        ));
        $this->hasColumn('details', 'string');
    }
    
    public function setUp()
    {
        parent::setUp();
        $this->hasOne('TicketsMm', array(
            'local' => 'id',
            'foreign' => 'ticket_id',
        ));
    }
}
TicketsMm.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
class TicketsMm extends Doctrine_Record
{
    public function setTableDefinition()
    {
        $this->setTableName('tickets_mm');
        $this->hasColumn('ticket_id', 'integer', 4, array(
            'primary' => true,
            'notnull' => true,
        ));
        $this->hasColumn('external_identifier', 'string', 30, array(
            'notnull' => true,
            'default' => '',
        ));
        $this->hasColumn('delivery_requested', 'boolean', 1, array(
            'notnull' => true,
            'default' => false,
        ));
    }
 
    public function setUp()
    {
        parent::setUp();
        $this->hasOne('Ticket', array(
            'local' => 'ticket_id',
            'foreign' => 'id'
        ));
    }
}