waltertamboer / doctrine-criteria-serializer
A small PHP library that can be used to serialize a Doctrine Criteria object.
dev-master
2014-11-24 23:09 UTC
Requires
- php: >=5.3.3
- doctrine/collections: v1.2
Requires (Dev)
- fabpot/php-cs-fixer: v1.1
- phpunit/phpunit: 4.3.*
This package is not auto-updated.
Last update: 2024-11-05 03:52:49 UTC
README
A small PHP library that can be used to serialize a Doctrine Criteria object.
Example
To serialize a criteria, simply call CriteriaSerializer::serialize
.
<?php use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\CriteriaSerializer; $criteria = Criteria::create(); $criteria->where($criteria->expr()->contains('field2', '2')); $serializer = new CriteriaSerializer(); $serializedString = $serializer->serialize($criteria);
To get a Criteria object again, simply call CriteriaSerializer::unserialize
.
<?php use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\CriteriaSerializer; $serializer = new CriteriaSerializer(); $criteria = $serializer->unserialize($data);