| @@ 504-515 (lines=12) @@ | ||
| 501 | * @param Datastore_Interface $datastore |
|
| 502 | * @return object $this |
|
| 503 | **/ |
|
| 504 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
| 505 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
| 506 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
| 507 | } |
|
| 508 | $this->datastore = $datastore; |
|
| 509 | $this->has_default_datastore = $set_as_default; |
|
| 510 | ||
| 511 | foreach ( $this->fields as $field ) { |
|
| 512 | $field->set_datastore( $this->get_datastore(), true ); |
|
| 513 | } |
|
| 514 | return $this; |
|
| 515 | } |
|
| 516 | ||
| 517 | /** |
|
| 518 | * Get the DataStore instance |
|
| @@ 189-200 (lines=12) @@ | ||
| 186 | * |
|
| 187 | * @param Datastore_Interface $datastore |
|
| 188 | */ |
|
| 189 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
| 190 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
| 191 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
| 192 | } |
|
| 193 | $this->datastore = $datastore; |
|
| 194 | $this->has_default_datastore = $set_as_default; |
|
| 195 | ||
| 196 | foreach ( $this->groups as $group ) { |
|
| 197 | $group->set_datastore( $this->get_datastore(), true ); |
|
| 198 | } |
|
| 199 | return $this; |
|
| 200 | } |
|
| 201 | ||
| 202 | /** |
|
| 203 | * Return a clone of a field with hierarchy settings applied |
|