/**
  * @inheritdoc
  */
 public function accept(ResourceIdentifierInterface $identifier, $record = null, $key = null, ResourceInterface $resource = null)
 {
     if (!$this->current) {
         return true;
     }
     return $this->current->getType() == $identifier->getType() && $this->current->getId() == $identifier->getId();
 }
 /**
  * @param ResourceIdentifierInterface $identifier
  * @return object|null
  *      the record, or null if it does not exist.
  */
 public function find(ResourceIdentifierInterface $identifier)
 {
     $model = $this->resolve($identifier->getType());
     $key = $this->resolveQualifiedKeyName($model, $identifier->getType());
     return $this->newQuery($model)->where($key, $identifier->getId())->first();
 }
 /**
  * RecordNotFoundException constructor.
  * @param ResourceIdentifierInterface $identifier
  * @param int $code
  * @param Exception|null $previous
  */
 public function __construct(ResourceIdentifierInterface $identifier, $code = 0, Exception $previous = null)
 {
     $message = sprintf('Cannot find Record %s:%s', $identifier->getType(), $identifier->getId());
     parent::__construct($message, $code, $previous);
     $this->identifier = $identifier;
 }
 /**
  * @inheritdoc
  */
 public function relationshipNotAcceptable(ResourceIdentifierInterface $identifier, $relationshipKey = null, $error = null)
 {
     $base = $this->repository->errorWithPointer(self::RELATIONSHIP_NOT_ACCEPTABLE, $relationshipKey ? P::relationship($relationshipKey) : P::data(), ['type' => $identifier->getType(), 'id' => $identifier->getId()]);
     $errors = new MutableErrorCollection();
     /** @var MutableErrorInterface $err */
     foreach (MutableErrorCollection::cast($error ?: $base) as $err) {
         $add = clone $base;
         $errors->add($add->merge($err));
     }
     return $errors;
 }
 /**
  * @inheritDoc
  */
 public function isSame(ResourceIdentifierInterface $identifier)
 {
     return $this->getType() === $identifier->getType() && $this->getId() == $identifier->getId();
 }