에서이 코멘트에 대해 약간의 설명을 드리겠습니다. Doctrine 2 자료로 작업 중이며 ObjectExists.php
및 NoObjectExists.php
과 같은 유효성 확인을 위해 Doctrine 모듈에 착수했습니다.Doctrine 2 모듈 'ObjectExists.php'
내 질문은 here 찾을 수있는 원래 코드에서입니다.
나는 "$options
필요한 키를 Doctrine\Common\Persistence\ObjectRepository
의 인스턴스 여야합니다 object_repository
을이다"언급 여기에 사실을 얻을 수
이 Doctrine\Common\Persistence\ObjectRepository
이후
는 인터페이스가
/**
* Constructor
*
* @param array $options required keys are `object_repository`, which must be an instance of
* Doctrine\Common\Persistence\ObjectRepository, and `fields`, with either
* a string or an array of strings representing the fields to be matched by the validator.
* @throws \Zend\Validator\Exception\InvalidArgumentException
*/
public function __construct(array $options)
{
if (!isset($options['object_repository']) || !$options['object_repository'] instanceof ObjectRepository) {
if (!array_key_exists('object_repository', $options)) {
$provided = 'nothing';
} else {
if (is_object($options['object_repository'])) {
$provided = get_class($options['object_repository']);
} else {
$provided = getType($options['object_repository']);
}
}
throw new Exception\InvalidArgumentException(sprintf(
'Option "object_repository" is required and must be an instance of'
. ' Doctrine\Common\Persistence\ObjectRepository, %s given',
$provided
));
}
$this->objectRepository = $options['object_repository'];
if (!isset($options['fields'])) {
throw new Exception\InvalidArgumentException(
'Key `fields` must be provided and be a field or a list of fields to be used when searching for'
. ' existing instances'
);
}
$this->fields = $options['fields'];
$this->validateFields();
parent::__construct($options);
}
, 어떻게 그 문을 디코딩한다 ?
또는 Doctrine\Common\Persistence\ObjectRepository
의 인스턴스 여야합니다 내가 ObjectsExists
클래스의 생성자를 호출하고 object_repository
통과 할 수있는 방법 즉,
누군가가 이것에 대해 약간의 질문을 던질 수 있습니까? 저는이 문제에 익숙해 져 있습니다. 제 질문에 너무 가혹하지 마십시오.
감사 Doctrine\Common\Persistence\ObjectRepository
이후