for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File was created 30.09.2015 07:52
*/
namespace PeekAndPoke\Component\Slumber\Annotation\Slumber;
use Doctrine\Common\Annotations\Annotation;
use PeekAndPoke\Component\Slumber\Core\Exception\SlumberException;
use PeekAndPoke\Component\Slumber\Core\Validation\ValidationContext;
* @Annotation
* @Annotation\Target("PROPERTY")
*
* @author Karsten J. Gerber <[email protected]>
class AsObject extends PropertyMappingMarkerBase
{
* @param ValidationContext $context
* @throws SlumberException
public function validate(ValidationContext $context)
if (empty($this->value)) {
throw $this->createValidationException(
$context,
'you must provide a class as value. Example @Slumber\AsObject( SomeClass::class )'
);
}
// NOTICE: we also accept interfaces here, as the interface can define a Slumber\Polymorphic
if (! class_exists($this->value) && ! interface_exists($this->value)) {
"you provided the non-existing class '$this->value'"
* @return bool
public function keepNullValuesInCollections()
return false;