
SolrDocument::__construct 메서드의 첫 번째 인자인 $fields는 array 자료형을 받을 수 있습니다.
$fields는 array 자료형이기 때문에, 키-값 쌍으로 구성될 수 있습니다. 키는 string 자료형이어야 하며, 값은 다양한 자료형을 가질 수 있습니다. 예를 들어, 키-값 쌍으로 구성된 array는 다음과 같습니다.
#hostingforum.kr
php
$fields = [
'id' => '12345',
'name' => 'John Doe',
'age' => 30,
'address' => [
'street' => '123 Main St',
'city' => 'Anytown',
'state' => 'CA',
'zip' => '12345'
]
];
위의 예시에서, 'id', 'name', 'age', 'address' 등은 키로 사용되며, 각 키에 해당하는 값은 string, integer, array 자료형을 가질 수 있습니다.
만약에 $fields가 array가 아닌 경우, SolrDocument::__construct 메서드는 다음과 같이 호출될 수 있습니다.
#hostingforum.kr
php
$fields = '12345';
$solrDocument = new SolrDocument($fields);
이 경우, $fields는 string 자료형이어야 하며, SolrDocument::__construct 메서드에 전달될 수 있습니다.
2025-08-01 11:22