Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
OperationDefinitionBuilder Class Reference

Public Member Functions

 build ()
 
 withName ($name)
 
 withOperation ($operation)
 
 withType ($type)
 
 withMetadata ($metadata)
 

Detailed Description

Definition at line 10 of file OperationDefinitionBuilder.php.

Member Function Documentation

◆ build()

build ( )

Function which builds an operation defintions based on the fields set by the user.

Returns
OperationDefinitionObject

Definition at line 51 of file OperationDefinitionBuilder.php.

52  {
53  return new OperationDefinitionObject(
54  $this->name,
55  $this->operation,
56  $this->type,
57  null,
58  null,
59  null,
60  null,
61  null,
62  $this->metadata,
63  null,
64  false
65  );
66  }

◆ withMetadata()

withMetadata (   $metadata)

Takes an array of values => type or an array of operation elements and transforms into operation metadata.

Parameters
array$metadata
Returns
OperationDefinitionBuilder

Definition at line 110 of file OperationDefinitionBuilder.php.

111  {
112  $primitives = [];
113  foreach ($metadata as $fieldName => $value) {
114  // type check here TODO
115  if (is_string($value)) {
116  $primitives[$fieldName] = $value;
117  } else {
118  $this->metadata[] = $value;
119  }
120  }
121 
122  $this->metadata = array_merge(
123  $this->metadata,
125  );
126  return $this;
127  }
$value
Definition: gender.phtml:16

◆ withName()

withName (   $name)

Sets the name of the operation definition to be built.

Parameters
string$name
Returns
OperationDefinitionBuilder

Definition at line 74 of file OperationDefinitionBuilder.php.

75  {
76  $this->name = $name;
77  return $this;
78  }
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ withOperation()

withOperation (   $operation)

Sets the name of the operation for the object to be built.

Parameters
string$operation
Returns
OperationDefinitionBuilder

Definition at line 86 of file OperationDefinitionBuilder.php.

87  {
88  $this->operation = $operation;
89  return $this;
90  }

◆ withType()

withType (   $type)

Sets the name of the type of operation (e.g. create, delete)

Parameters
string$type
Returns
OperationDefinitionBuilder

Definition at line 98 of file OperationDefinitionBuilder.php.

99  {
100  $this->type = $type;
101  return $this;
102  }
$type
Definition: item.phtml:13

The documentation for this class was generated from the following file: