本文整理汇总了PHP中eZ\Publish\API\Repository\Values\Content\Query\Criterion类的典型用法代码示例。如果您正苦于以下问题:PHP Criterion类的具体用法?PHP Criterion怎么用?PHP Criterion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Criterion类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Creates a new TagKeyword criterion.
*
* @param string $operator
* @param string|string[] $value One or more tag keywords that must be matched
* @param string $target Field definition identifier to use
* @param \eZ\Publish\API\Repository\Values\Content\Query\Criterion\Value $valueData
*
* @throws \InvalidArgumentException if a non string parameter is given
* @throws \InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($operator, $value, $target = null, Value $valueData = null)
{
parent::__construct($target, $operator, $value, $valueData);
}
示例2: __construct
/**
* Creates a new Visibility criterion.
*
* @param int $value Visibility: self::VISIBLE, self::HIDDEN
*
* @throws \InvalidArgumentException
*/
public function __construct($value)
{
if ($value !== self::VISIBLE && $value !== self::HIDDEN) {
throw new InvalidArgumentException("Invalid visibility value {$value}");
}
parent::__construct(null, null, $value);
}
示例3: __construct
/**
* Creates a new DateMetadata criterion on $metadata
*
* @throws \InvalidArgumentException If target is unknown
*
* @param string $target One of DateMetadata::CREATED or DateMetadata::MODIFIED
* @param string $operator One of the Operator constants
* @param mixed $value The match value, either as an array of as a single value, depending on the operator
*/
public function __construct($target, $operator, $value)
{
if ($target != self::MODIFIED && $target != self::CREATED) {
throw new InvalidArgumentException("Unknown DateMetadata {$target}");
}
parent::__construct($target, $operator, $value);
}
示例4: __construct
/**
* Creates a new LanguageCode criterion.
*
* @param string|string[] $value One or more language codes that must be matched
* @param bool $matchAlwaysAvailable Denotes if always-available Content is to be matched regardless
* of language codes, this is the default behaviour
*
* @throws \InvalidArgumentException if non string value is given
* @throws \InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($value, $matchAlwaysAvailable = true)
{
if (!is_bool($matchAlwaysAvailable)) {
throw new InvalidArgumentType('matchAlwaysAvailable', 'boolean', $matchAlwaysAvailable);
}
$this->matchAlwaysAvailable = $matchAlwaysAvailable;
parent::__construct(null, null, $value);
}
示例5: __construct
/**
* Creates a new SubTree criterion.
*
* @param string|string[] $value an array of subtree path strings, eg: /1/2/
*
* @throws InvalidArgumentException if a non path string is given
* @throws InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($value)
{
foreach ((array) $value as $pathString) {
if (preg_match('/^(\\/\\w+)+\\/$/', $pathString) !== 1) {
throw new InvalidArgumentException("value '{$pathString}' must follow the pathString format, eg /1/2/");
}
}
parent::__construct(null, null, $value);
}
示例6: __construct
/**
* Creates a new UserMetadata criterion on $metadata.
*
* @throws \InvalidArgumentException If target is unknown
*
* @param string $target One of UserMetadata::OWNER, UserMetadata::GROUP or UserMetadata::MODIFIED
* @param string $operator One of the Operator constants
* @param mixed $value The match value, either as an array of as a single value, depending on the operator
*/
public function __construct($target, $operator, $value)
{
switch ($target) {
case self::OWNER:
case self::GROUP:
case self::MODIFIER:
parent::__construct($target, $operator, $value);
return;
}
throw new InvalidArgumentException("Unknown UserMetadata {$target}");
}
示例7: __construct
public function __construct($value, array $properties = array())
{
parent::__construct(null, Operator::LIKE, $value);
// Assign additional properties, ugly but with the existing constructor
// API the only sensible way, I guess.
foreach ($properties as $name => $value) {
if (!isset($this->{$name})) {
throw new \InvalidArgumentException("Unknown property {$name}.");
}
$this->{$name} = $value;
}
}
示例8: __construct
/**
* Creates a new Status criterion
*
* @param string|string[] $value Status: self::STATUS_ARCHIVED, self::STATUS_DRAFT, self::STATUS_PUBLISHED
*
* @throws \InvalidArgumentException
*/
public function __construct($value)
{
foreach ((array) $value as $statusValue) {
switch ($statusValue) {
case self::STATUS_ARCHIVED:
case self::STATUS_DRAFT:
case self::STATUS_PUBLISHED:
continue;
default:
throw new InvalidArgumentException("Invalid status {$statusValue}");
}
}
parent::__construct(null, null, $value);
}
示例9: __construct
/**
* Creates a new remoteId criterion.
*
* @param int|int[] $value One or more remoteId that must be matched
*
* @throws \InvalidArgumentException if a non numeric id is given
* @throws \InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($value)
{
parent::__construct(null, null, $value);
}
示例10: __construct
/**
* Creates a new more like this criterion.
*
* @param int $type the type (one of CONTENT,TEXT,URL)
* @param mixed $value the value depending on the type
*
* @throws \InvalidArgumentException if the value type doesn't match the expected type
*/
public function __construct($type, $value)
{
$this->type = $type;
parent::__construct(null, null, $value);
}
示例11: __construct
/**
* Creates a new LocationPriority criterion
*
* @param string $operator One of the Operator constants
* @param mixed $value The match value, either as an array of as a single value, depending on the operator
*
* @deprecated Since 5.3, use Location search instead
*/
public function __construct($operator, $value)
{
parent::__construct(null, $operator, $value);
}
示例12: __construct
/**
* @param string $target FieldDefinition identifier
* @param string $operator One of the supported Operator constants
* @param float|float[] $distance The match value in kilometers, either as an array
* or as a single value, depending on the operator
* @param float $latitude Latitude of the location that distance is calculated from
* @param float $longitude Longitude of the location that distance is calculated from
*/
public function __construct($target, $operator, $distance, $latitude, $longitude)
{
$distanceStart = new MapLocationValue($latitude, $longitude);
parent::__construct($target, $operator, $distance, $distanceStart);
}
示例13: __construct
/**
* Creates a new TagId criterion.
*
* @param int|int[] $value One or more tag IDs that must be matched
* @param string $target Field definition identifier to use
*
* @throws \InvalidArgumentException if a non numeric id is given
* @throws \InvalidArgumentException if the value type doesn't match the operator
*/
public function __construct($value, $target = null)
{
parent::__construct($target, null, $value);
}