|
@@ 340-362 (lines=23) @@
|
| 337 |
|
/** |
| 338 |
|
* {@inheritdoc} |
| 339 |
|
*/ |
| 340 |
|
public function remove($key) |
| 341 |
|
{ |
| 342 |
|
// TODO: If the keys are persistent as well (not yet implemented) |
| 343 |
|
// and the collection is not initialized and orphanRemoval is |
| 344 |
|
// not used we can issue a straight SQL delete/update on the |
| 345 |
|
// association (table). Without initializing the collection. |
| 346 |
|
$removed = parent::remove($key); |
| 347 |
|
|
| 348 |
|
if ( ! $removed) { |
| 349 |
|
return $removed; |
| 350 |
|
} |
| 351 |
|
|
| 352 |
|
$this->changed(); |
| 353 |
|
|
| 354 |
|
if ($this->association !== null && |
| 355 |
|
$this->association['type'] & ClassMetadata::TO_MANY && |
| 356 |
|
$this->owner && |
| 357 |
|
$this->association['orphanRemoval']) { |
| 358 |
|
$this->em->getUnitOfWork()->scheduleOrphanRemoval($removed); |
| 359 |
|
} |
| 360 |
|
|
| 361 |
|
return $removed; |
| 362 |
|
} |
| 363 |
|
|
| 364 |
|
/** |
| 365 |
|
* {@inheritdoc} |
|
@@ 600-609 (lines=10) @@
|
| 597 |
|
* |
| 598 |
|
* @return array |
| 599 |
|
*/ |
| 600 |
|
public function slice($offset, $length = null) |
| 601 |
|
{ |
| 602 |
|
if ( ! $this->initialized && ! $this->isDirty && $this->association['fetch'] === ClassMetadata::FETCH_EXTRA_LAZY) { |
| 603 |
|
$persister = $this->em->getUnitOfWork()->getCollectionPersister($this->association); |
| 604 |
|
|
| 605 |
|
return $persister->slice($this, $offset, $length); |
| 606 |
|
} |
| 607 |
|
|
| 608 |
|
return parent::slice($offset, $length); |
| 609 |
|
} |
| 610 |
|
|
| 611 |
|
/** |
| 612 |
|
* Cleans up internal state of cloned persistent collection. |