diff --git a/src/ORM/Blameable/BlameableListener.php b/src/ORM/Blameable/BlameableListener.php new file mode 100644 index 00000000..4d882e93 --- /dev/null +++ b/src/ORM/Blameable/BlameableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Blameable; + +/** + * @deprecated + */ +final class BlameableListener extends BlameableSubscriber +{ + public function __construct() + { + trigger_error('use BlameableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/Geocodable/GeocodableListener.php b/src/ORM/Geocodable/GeocodableListener.php new file mode 100644 index 00000000..d97ba56d --- /dev/null +++ b/src/ORM/Geocodable/GeocodableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Geocodable; + +/** + * @deprecated + */ +final class GeocodableListener extends GeocodableSubscriber +{ + public function __construct() + { + trigger_error('use GeocodableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/Loggable/LoggableListener.php b/src/ORM/Loggable/LoggableListener.php new file mode 100644 index 00000000..7a6aeb7a --- /dev/null +++ b/src/ORM/Loggable/LoggableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Loggable; + +/** + * @deprecated + */ +final class LoggableListener extends LoggableSubscriber +{ + public function __construct() + { + trigger_error('use LoggableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/Sluggable/SluggableListener.php b/src/ORM/Sluggable/SluggableListener.php new file mode 100644 index 00000000..811cb5c6 --- /dev/null +++ b/src/ORM/Sluggable/SluggableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Sluggable; + +/** + * @deprecated + */ +final class SluggableListener extends SluggableSubscriber +{ + public function __construct() + { + trigger_error('use SluggableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/SoftDeletable/SoftDeletableListener.php b/src/ORM/SoftDeletable/SoftDeletableListener.php new file mode 100644 index 00000000..86cfd595 --- /dev/null +++ b/src/ORM/SoftDeletable/SoftDeletableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\SoftDeletable; + +/** + * @deprecated + */ +final class SoftDeletableListener extends SoftDeletableSubscriber +{ + public function __construct() + { + trigger_error('use SoftDeletableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/Timestampable/TimestampableListener.php b/src/ORM/Timestampable/TimestampableListener.php new file mode 100644 index 00000000..7bdfbad6 --- /dev/null +++ b/src/ORM/Timestampable/TimestampableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Timestampable; + +/** + * @deprecated + */ +final class TimestampableListener extends TimestampableSubscriber +{ + public function __construct() + { + trigger_error('use TimestampableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/src/ORM/Translatable/TranslatableListener.php b/src/ORM/Translatable/TranslatableListener.php new file mode 100644 index 00000000..f7125981 --- /dev/null +++ b/src/ORM/Translatable/TranslatableListener.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Knp\DoctrineBehaviors\ORM\Translatable; + +/** + * @deprecated + */ +final class TranslatableListener extends TranslatableSubscriber +{ + public function __construct() + { + trigger_error('use TranslatableSubscriber instead.', E_USER_DEPRECATED); + call_user_func_array(array('parent', '__construct'), func_get_args()); + } +} diff --git a/tests/Knp/DoctrineBehaviors/ORM/BlameableTest.php b/tests/Knp/DoctrineBehaviors/ORM/BlameableTest.php index 4fa03256..f16fc1c5 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/BlameableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/BlameableTest.php @@ -190,4 +190,19 @@ public function should_only_persist_user_string() $this->assertNull($entity->getCreatedBy(), 'createdBy is a not updated because not a user entity object'); $this->assertNull($entity->getUpdatedBy(), 'updatedBy is a not updated because not a user entity object'); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Blameable\BlameableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php b/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php index 69a98ef6..01da37df 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php @@ -110,4 +110,19 @@ public function testFindByDistance() $cities = $repo->findByDistance(new Point(47.896319, 7.352943), 6223000); $this->assertCount(3, $cities, 'Paris, Nantes and New-York are less than 6223 km far from Reguisheim'); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Geocodable\GeocodableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/LoggableTest.php b/tests/Knp/DoctrineBehaviors/ORM/LoggableTest.php index f9dbbd6f..2d31a57a 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/LoggableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/LoggableTest.php @@ -124,4 +124,19 @@ public function should_log_removal_message_when_deleted() 'BehaviorFixtures\ORM\LoggableEntity #1 removed' ); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Loggable\LoggableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/SluggableTest.php b/tests/Knp/DoctrineBehaviors/ORM/SluggableTest.php index 7c54c141..3e540b84 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/SluggableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/SluggableTest.php @@ -100,4 +100,19 @@ public function testUpdatedSlug() $this->assertEquals($entity->getSlug(), $expected); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Sluggable\SluggableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/SoftDeletableTest.php b/tests/Knp/DoctrineBehaviors/ORM/SoftDeletableTest.php index 6c7aa8cd..84ae83b5 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/SoftDeletableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/SoftDeletableTest.php @@ -103,4 +103,19 @@ public function testDeleteInheritance() $this->assertTrue($entity->isDeleted()); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\SoftDeletable\SoftDeletableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/TimestampableTest.php b/tests/Knp/DoctrineBehaviors/ORM/TimestampableTest.php index 349d9ec8..2468899c 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/TimestampableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/TimestampableTest.php @@ -161,4 +161,19 @@ public function it_should_modify_update_datetime_only_once() 'Update timestamp has changed' ); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Timestampable\TimestampableListener; + } + + public function tearDown() + { + restore_error_handler(); + } } diff --git a/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php b/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php index eae04cc8..544d0fa1 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php @@ -180,4 +180,19 @@ public function should_remove_translation() $em->refresh($entity); $this->assertNotEquals('Hallo', $entity->translate('nl')->getTitle()); } + + /** + * @test + * @expectedException Exception + */ + public function should_notice_deprecation() + { + set_error_handler(function() {throw new \Exception; }, E_USER_DEPRECATED); + new \Knp\DoctrineBehaviors\ORM\Translatable\TranslatableListener; + } + + public function tearDown() + { + restore_error_handler(); + } }