Ticket #1072 (closed defect: fixed)

Opened 14 months ago

Last modified 10 months ago

Relation testing throws an exception

Reported by: Max_Schreck Owned by: romanb
Priority: minor Milestone:
Component: Relations Version: 0.11.0
Severity: Keywords:
Cc: Has Test:
Status: Has Patch:

Description

Test schema:

PaymentDetail:
  tableName: payment_detail
  columns:
    name:
      type: string(255)
      notnull: true
  options:
    charset: utf8

BankTransaction:
  tableName: bank_transaction
  columns:
    payment_detail_id:
      type: integer
    name:
      type: string(255)
      notnull: true
  relations:
    PaymentDetail:
      local: payment_detail_id
      foreignAlias: BankTransaction
      foreignType: one
  options:
    charset: utf8

Test code:

if (!($bankTransaction = Doctrine::getTable('BankTransaction')->createQuery()->limit(1)->execute()->getFirst()))
{
  $bankTransaction = new BankTransaction();
}

// If I test this here...
if ($bankTransaction->PaymentDetail)
{
}

$bankTransaction->name = uniqid();
$bankTransaction->save();

// ...and this here - it will throw an exception
// Doctrine_Record_Exception with message
// 'Unknown record property / related component
// "payment_detail_id" on "BankTransaction"'
if ($bankTransaction->payment_detail_id)
{
}

Attachments

1072TestCase.php (3.0 KB) - added by Max_Schreck 13 months ago.

Change History

follow-up: ↓ 2   Changed 14 months ago by jwage

Can you create a failing Doctrine test case?

in reply to: ↑ 1   Changed 14 months ago by Max_Schreck

Replying to jwage:

Can you create a failing Doctrine test case?

I attached 1072TestCase.php test case file. It's my first for Doctrine so I hope it's fine. :)

  Changed 13 months ago by Max_Schreck

I've found another related issue. If I access a relation and then I try to fetch a value from its column, Doctrine returns object instead of expected NULL value. Updated test case file is attached.

Changed 13 months ago by Max_Schreck

  Changed 13 months ago by jwage

  • milestone changed from 0.11.0 to 0.11.1

  Changed 13 months ago by romanb

  • status changed from new to closed
  • resolution set to fixed

Fixed #1072. Please read through my comments in the testcase to see what has been fixed, what not and for what reasons.

  Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Note: See TracTickets for help on using tickets.