Find a group by a specific property

@param string $key   property name
@param mixed  $value property value

@throws NotFoundHttpException                if user does not exist
@return \FOS\UserBundle\Model\GroupInterface
502576
protected function findGroupBy($key, $value)
    {
        if (!empty($value)) {
            $group = $this->get('fos_user.group_manager')->{'findGroupBy'.ucfirst($key)}($value);
        }

        if (empty($group)) {
            throw new NotFoundHttpException(sprintf('The group with "%s" does not exist for value "%s"', $key, $value));
        }

        return $group;
    }
1333490
private function filter($key, $value)
    {
        if (isset($this->filters[ $key ])) {
            foreach ($this->filters[ $key ] as $filter) {
                $value = $filter($value);
            }
        }

        return $value;
    }
1074015
public function set($key, $value)
    {
        // take care about replacing keys !
        if (is_resource($value) || $value instanceof StreamInterface) {
            $res = file_put_contents($this->filePath($key), $value);
            if ($res !== false) {
                // clear plain storage from key
                return $this->deleteStore($key);
            }
            return $res;
        } else {
            $this->storage[$key] = $value;
            $res = $this->save();
            if ($res !== false) {
                // clear file storage from key
                return $this->deleteFile($key);
            }
            return $res;
        }
    }
1100697
protected function resolveExplicitBindingIfPossible($key, $value)
    {
        $binder = $this->binder();

        if ($binder && $binder->getBindingCallback($key)) {
            return call_user_func($binder->getBindingCallback($key), $value);
        }

        return $value;
    }
164169
public function get($key, $value = null)
    {
        return $this->queryBag->key($key, $value, true);
    }
230551
public function setValue($key, $value) {
		if( !isset($key) ) {
			// Invalid key
			throw new Exception("nullKey");
			
		} else if( !in_array($key, static::$fields) ) {
			// Unknown key
			throw new FieldNotFoundException($key, static::getClass());
			
		} else if( $key === static::$IDFIELD ) {
			// ID is not editable
			throw new Exception("idNotEditable");
			
		} else if( $value !== $this->data[$key] ) {
			// The value is different
			$this->addModFields($key);
			$this->data[$key] = $value;
		}
		return $this;
	}
253714
public function setProperty($key, $value = null){
		if($key instanceof Property){
			$value	= $key;
			$key	= $key->getName();
		}elseif(!$value instanceof Property){
			$value	= new Property($key, $value);
		}
		
		foreach($this->properties as $index=>$property){
			if($property->getName() == $key){
				unset($this->properties[$index]);
			}
		}
		
		$this->properties[] = $value;
		return $this;
	}
893817
public function filterByValue($value)
    {
        $callback = function (BindingInterface $binding, $key) use ($value) {
            return $binding->getValue() == $value;
        };

        return $this->filter($callback);
    }
506628
public function where($key, $value)
    {
        $filter = $this->createFilter($key, $value);
        return new static(array_filter($this->source, $filter));
    }
861676
public function pluck($value, $key = null)
    {
        return new static(ArrayHelper::pluck($this->items, $value, $key));
    }
1241598
public function create($key, $value, $group = Manager::DEFAULT_GROUP)
    {
        return $this->createModel()->create([
            'key' => $key,
            'value' => $value,
            'group' => $group,
        ]);
    }
1365736
public function bind($key, $value = null)
    {
        if (is_array($key))
        {
            foreach ($key as $name => $value)
            {
                $this->_bound[$name] = $value;
            }
        }
        else
        {
            $this->_bound[$key] = $value;
        }

        return $this;
    }
317729
public function where($key, $value)
    {
        return $this->filter(function (NodeInterface $node) use ($key, $value) {
            $property = $node->getProperty($key);

            return $value === $property;
        });
    }
74619
protected function getBy($key, $value)
    {
        $stmt = $this->pdo->prepare('SELECT * FROM ' . $this->tableName . ' WHERE ' . $key . ' = :value');
        $result = $stmt->execute(['value'=>$value]);
        return $this->processRow($stmt->fetch(PDO::FETCH_ASSOC));
    }
838298
public function getUser($property, $value)
    {
        $class = new \core_kernel_classes_Class(GenerisRdf::CLASS_GENERIS_USER);

        $users = \tao_models_classes_UserService::singleton()->searchInstances(
            array($property => $value), 
            $class,
            array('like' => false, 'recursive' => true)
        );
        $user = empty($users) ? null : current($users);
        
        return $user;
    }
321472
public function fetchPairs($key, $value = NULL) {
		$return = array();
		foreach ($this as $row) {
			$return[$row->$key] = $value ? $row->$value : $row->$key;
		}
		return $return;
	}
922830
public function contains($key, $value)
    {
        return \in_array($value, $this->get($key, null, false));
    }