Skip to content

Commit

Permalink
Merge pull request #11 from mybuilder/remove-deprecated-serializable-…
Browse files Browse the repository at this point in the history
…interface-dependency

Remove dependency on deprecated `\Serializable` interface
  • Loading branch information
rainerkraftmb authored Mar 27, 2023
2 parents 0a5576b + c836171 commit 7f41cda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
25 changes: 7 additions & 18 deletions runtime/lib/collection/PropelCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* @author Francois Zaninotto
* @package propel.runtime.collection
*/
class PropelCollection extends ArrayObject implements Serializable
class PropelCollection extends ArrayObject
{
/**
* @var string
Expand Down Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions runtime/lib/collection/PropelOnDemandCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 7f41cda

Please sign in to comment.