/**
  * @param string     $keyType
  * @param string     $type
  * @param Collection $collection
  */
 public function __construct($keyType, $type, Collection $collection = null, $keyExtractor = null)
 {
     if (in_array($keyType, self::$invalidKeyTypes, false)) {
         throw new InvalidKeyTypeException($keyType);
     }
     if ($keyExtractor && (!is_callable($keyExtractor) && !method_exists($type, $keyExtractor))) {
         throw new \InvalidArgumentException(sprintf('Passed keyExtractor is neither a callable nor a method of class "%s"', $type));
     }
     $this->keyType = $keyType;
     $this->keyExtractor = $keyExtractor;
     // @todo verify key integrity in passed collection -> doInitialize
     parent::__construct($type, $collection);
 }
Beispiel #2
0
 /**
  * @param Collection $collection
  */
 public function __construct(Collection $collection = null)
 {
     parent::__construct(Blog::class, $collection);
 }
Beispiel #3
0
 /**
  * @param Collection $collection
  * @param null       $keyExtractor
  */
 public function __construct(Collection $collection = null, $keyExtractor = null)
 {
     parent::__construct(DisplayableInterface::class, $collection, $keyExtractor);
 }