diff --git a/runtime/lib/collection/PropelCollection.php b/runtime/lib/collection/PropelCollection.php index 26637b5f0..8a6562d56 100644 --- a/runtime/lib/collection/PropelCollection.php +++ b/runtime/lib/collection/PropelCollection.php @@ -25,7 +25,7 @@ * @author Francois Zaninotto * @package propel.runtime.collection */ -class PropelCollection extends ArrayObject implements Serializable +class PropelCollection extends ArrayObject { /** * @var string @@ -354,29 +354,18 @@ public function diff(PropelCollection $collection) return $diff; } - // Serializable interface - - /** - * @return string - */ - public function serialize(): string + public function __serialize(): array { - $repr = array( + return [ 'data' => $this->getArrayCopy(), 'model' => $this->model, - ); - - return serialize($repr); + ]; } - /** - * @param string $data - */ - public function unserialize($data): void + public function __unserialize(array $data): void { - $repr = unserialize($data); - $this->exchangeArray($repr['data']); - $this->model = $repr['model']; + $this->exchangeArray($data['data']); + $this->model = $data['model']; } // IteratorAggregate method diff --git a/runtime/lib/collection/PropelOnDemandCollection.php b/runtime/lib/collection/PropelOnDemandCollection.php index 6ed0063e6..e2d4eb20a 100644 --- a/runtime/lib/collection/PropelOnDemandCollection.php +++ b/runtime/lib/collection/PropelOnDemandCollection.php @@ -114,18 +114,15 @@ public function offsetUnset($offset) /** * @throws PropelException */ - public function serialize() + public function __serialize(): array { throw new PropelException('The On Demand Collection cannot be serialized'); } /** * @throws PropelException - * @param string $data - * - * @return void */ - public function unserialize($data) + public function __unserialize(array $data): void { throw new PropelException('The On Demand Collection cannot be serialized'); }