|
@@ 348-370 (lines=23) @@
|
| 345 |
|
/** |
| 346 |
|
* {@inheritdoc} |
| 347 |
|
*/ |
| 348 |
|
public function remove($key) |
| 349 |
|
{ |
| 350 |
|
// TODO: If the keys are persistent as well (not yet implemented) |
| 351 |
|
// and the collection is not initialized and orphanRemoval is |
| 352 |
|
// not used we can issue a straight SQL delete/update on the |
| 353 |
|
// association (table). Without initializing the collection. |
| 354 |
|
$removed = parent::remove($key); |
| 355 |
|
|
| 356 |
|
if ( ! $removed) { |
| 357 |
|
return $removed; |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
$this->changed(); |
| 361 |
|
|
| 362 |
|
if ($this->association !== null && |
| 363 |
|
$this->association['type'] & ClassMetadata::TO_MANY && |
| 364 |
|
$this->owner && |
| 365 |
|
$this->association['orphanRemoval']) { |
| 366 |
|
$this->em->getUnitOfWork()->scheduleOrphanRemoval($removed); |
| 367 |
|
} |
| 368 |
|
|
| 369 |
|
return $removed; |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
/** |
| 373 |
|
* {@inheritdoc} |
|
@@ 608-617 (lines=10) @@
|
| 605 |
|
* |
| 606 |
|
* @return array |
| 607 |
|
*/ |
| 608 |
|
public function slice($offset, $length = null) |
| 609 |
|
{ |
| 610 |
|
if ( ! $this->initialized && ! $this->isDirty && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) { |
| 611 |
|
$persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
| 612 |
|
|
| 613 |
|
return $persister->slice($this, $offset, $length); |
| 614 |
|
} |
| 615 |
|
|
| 616 |
|
return parent::slice($offset, $length); |
| 617 |
|
} |
| 618 |
|
|
| 619 |
|
/** |
| 620 |
|
* Cleans up internal state of cloned persistent collection. |