ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter::getDescription PHP Метод

getDescription() публичный метод

public getDescription ( string $resourceClass ) : array
$resourceClass string
Результат array
    public function getDescription(string $resourceClass) : array
    {
        $description = [];
        $properties = $this->properties;
        if (null === $properties) {
            $properties = array_fill_keys($this->getClassMetadata($resourceClass)->getFieldNames(), null);
        }
        foreach ($properties as $property => $unused) {
            if (!$this->isPropertyMapped($property, $resourceClass) || !$this->isBooleanField($property, $resourceClass)) {
                continue;
            }
            $description[$property] = ['property' => $property, 'type' => 'bool', 'required' => false];
        }
        return $description;
    }

Usage Example

Пример #1
0
 public function testGetDescriptionDefaultFields()
 {
     $filter = new BooleanFilter($this->managerRegistry, new RequestStack());
     $this->assertEquals(['dummyBoolean' => ['property' => 'dummyBoolean', 'type' => 'bool', 'required' => false]], $filter->getDescription($this->resourceClass));
 }