Ticket #634 (closed enhancement: fixed)

Opened 19 months ago

Last modified 14 months ago

describe refresh and refreshRelated in the manual

Reported by: chris Owned by: somebody
Priority: minor Milestone: 0.11.0
Component: Documentation Version: 0.10.0
Severity: Keywords:
Cc: Has Test:
Status: Has Patch:

Description (last modified by chris) (diff)

UPDATE: Please mention refresh and refreshRelated in the manual.

Old summary: refresh method does not update relationship collections Old description:

$book = new Book();
$book->title = "Jungle Expedition Handbook";

$archimedes = new Author();
$archimedes->name = 'Archimedes Q. Porter';
$archimedes->books[] = $book;

$dummy = $book->authors;
$archimedes->save();
$dummy = $book->authors;
assert( 0 === count($book->authors) );

$book->refresh();
assert( 0 === count($book->authors) );

$doctrine->queryOne("FROM Book");
assert( 1 === count($book->authors) );

This is related to  http://doctrine.pengus.net/trac/ticket/622

Change History

Changed 19 months ago by chris

  • description modified (diff)

Changed 19 months ago by romanb

What about refresh(true) ? The optional argument $deep seems to be FALSE by default currently, which means its a "flat" refresh that doesnt affect relations by default.

Changed 19 months ago by chris

  • priority changed from critical to minor
  • type changed from defect to enhancement
  • component changed from general to documentation
  • description modified (diff)
  • summary changed from refresh method does not update relationship collections to describe refresh and refreshRelated in the manual

This does not work in my revision 3019. Maybe it works in the current trunk.

$deep is also not documented in the API docs ( http://doctrine.pengus.net/index.php/documentation/api/trunk/Doctrine_Record), but I saw that refreshRelated does the trick:

$dummy = $book->authors;
$archimedes->save();
$dummy = $book->authors;
assert( 0 === count($book->authors) );

$book->refresh();
assert( 0 === count($book->authors) );
		
$book->refresh(true);
assert( 0 === count($book->authors) );
		
$book->refreshRelated("authors");
assert( 1 === count($book->authors) );
				
$doctrine->queryOne("FROM Book WHERE id = ?", array($book->id));
assert( 1 === count($book->authors) );

Neither of them is documented in the manual. So I change this request to a documentation enhancement :).

Changed 19 months ago by romanb

  • milestone set to beta3

Changed 18 months ago by jwage

  • milestone changed from beta3 to 1.0

Changed 16 months ago by anonymous

  • milestone 1.0 deleted

Milestone 1.0 deleted

Changed 16 months ago by jwage

  • version set to 0.10
  • milestone changed from 2.0.0 to 0.10.5

Changed 14 months ago by jwage

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

(In [4299]) fixes #634

Note: See TracTickets for help on using tickets.