@param FamilyInterface $family

@return FamilyPermission
976937
public function setFamily(FamilyInterface $family = null): FamilyPermission
    {
        $this->familyCode = $family ? $family->getCode() : null;

        return $this;
    }
915506
protected function getQueryBuilderByFamily(Request $request, FamilyInterface $family)
    {
        $term = '%'.trim($request->get('term'), '%').'%';

        return $this->dataManager->getQbForFamiliesAndLabel([$family], $term);
    }
1163196
public function databaseGet($family, $key)
    {
        $cmd = implode(
            ' ',
            array('DATABASE', 'GET', '"' . $family. '"', '"' . $key . '"')
        );
        $result = $this->send($cmd);
        if ($result->isResult(0)) {
            throw new DatabaseInvalidEntryException('Invalid family or key.');
        }
        return substr($result->getData(), 1, -1);
    }
55956
protected final Person getMother(final Family family) {
        final FamilyNavigator navigator = new FamilyNavigator(family);
        return navigator.getMother();
    }
107232
protected function setFamily(FamilyInterface $family)
    {
        $this->family = $family;
        $this->container->get('router')->getContext()->setParameter('familyCode', $family->getCode());
    }
901819
public function setFamily($family)
    {
        if (!isset($this->config[$family])) {
            throw new UnknownFamilyMeasureException();
        }

        $this->family = $family;

        return $this;
    }
1279847
protected function findPermission(RequesterInterface $requester, ResourceInterface $resource)
    {
        if (null === $permission = $this->permissionBuffer->get($requester, $resource)) {
            try {
                $mask = $this->databaseProvider->findMask($requester, $resource);
            } catch (MaskNotFoundException $e) {
                throw new PermissionNotFoundException($requester, $resource);
            }

            $permission = $this->initPermission($requester, $resource, $mask);
            $permission->setPersistent(true);

            $this->permissionBuffer->add($permission);
        }

        return $permission;
    }
253800
public function getQbForFamiliesAndIdentifier(array $families, $term)
    {
        $eavQb = $this->createEAVQueryBuilder();
        $orCondition = [];
        foreach ($families as $family) {
            $identifierAttribute = $family->getAttributeAsIdentifier();
            if (!$identifierAttribute) {
                throw new \LogicException("Family {$family->getCode()} has no identifier");
            }
            $orCondition[] = $eavQb->attribute($identifierAttribute)->like($term);
        }

        return $eavQb->apply($eavQb->getOr($orCondition));
    }
443310
public function getByParent(FamilyInterface $family)
    {
        $families = [];
        foreach ($this->families as $subFamily) {
            if ($subFamily->getParent() && $subFamily->getParent()->getCode() === $family->getCode()) {
                $families[$subFamily->getCode()] = $subFamily;
            }
        }

        return $families;
    }
671904
public function getCUpdateExecutor($family)
    {
        if(!array_key_exists($family, $this->updateExecutorsC))
        {
            throw new CoreException('Исполнитель изменений (update executor) простых(C) типов пакета '.$family.' не найдена в медиаторе!');
        }

        return $this->updateExecutorsC[$family];
    }
819541
public function deleteFromFamily($family)
    {
        $this->mutations[] = (new Mutation)
            ->setDeleteFromFamily(
                (new DeleteFromFamily)->setFamilyName($family)
            );
        return $this;
    }
917402
public function exportAction(Request $request, FamilyInterface $family)
    {
        $this->setFamily($family);

        $exportConfig = $this->getExportConfig($request);
        $defaultFormOptions = $this->getDefaultFormOptions($request, 'export');
        $attr = $defaultFormOptions['attr'] ?? [];
        $attr['data-target-element'] = null; // Deep merge hell
        $form = $this->getForm(
            $request,
            $exportConfig,
            [
                'family' => $family,
                'attr' => $attr,
            ]
        );

        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            return $this->generateExport($form->getData());
        }

        return $this->renderAction($this->getViewParameters($request, $form));
    }
1158934
public function grantAccessByRole($role, UserInterface $user = null)
    {
        $user = $user ? : $this->currentUser();
        return in_array($role, $user->getRoles());
    }
18767
private function significant(Family $family): stdClass
    {
        $significant = (object) [
            'family'     => $family,
            'individual' => null,
            'surname'    => '',
        ];

        foreach ($family->spouses()->merge($family->children()) as $individual) {
            $significant->individual = $individual;
            [$significant->surname] = explode(',', $individual->sortName());
            break;
        }

        return $significant;
    }
326254
protected function extractPermissions(TokenInterface $token)
    {
        $user = $token->getUser();
        if (!$user instanceof User) {
            return [];
        }

        return $user->getCombinedFamilyPermissions();
    }
288863
public function dispatch(RequestInterface $request)
    {
        if (!$request->getParam('section')) {
            $request->setParam('section', $this->configStructure->getFirstSection()->getId());
        }

        return parent::dispatch($request);
    }
120300
protected function processPermissions(RoleInterface $role, $permissions)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var Permission $entity */

            return $entity->getId();
        };

        $delete = function($permission) {
            $this->getDoctrine()->getManager()->remove($permission);
        };

        $update = function($permission, $permissionData) {
            return $this->updatePermission($permission, $permissionData);
        };

        $add = function($permission) use ($role) {
            return $this->addPermission($role, $permission);
        };

        return $restHelper->processSubEntities($role->getPermissions(), $permissions, $get, $add, $update, $delete);
    }