| @@ 510-521 (lines=12) @@ | ||
| 507 | * @param Datastore_Interface $datastore |
|
| 508 | * @return object $this |
|
| 509 | **/ |
|
| 510 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
| 511 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
| 512 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
| 513 | } |
|
| 514 | $this->datastore = $datastore; |
|
| 515 | $this->has_default_datastore = $set_as_default; |
|
| 516 | ||
| 517 | foreach ( $this->fields as $field ) { |
|
| 518 | $field->set_datastore( $this->get_datastore(), true ); |
|
| 519 | } |
|
| 520 | return $this; |
|
| 521 | } |
|
| 522 | ||
| 523 | /** |
|
| 524 | * Get the DataStore instance |
|
| @@ 197-208 (lines=12) @@ | ||
| 194 | * |
|
| 195 | * @param Datastore_Interface $datastore |
|
| 196 | */ |
|
| 197 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
| 198 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
| 199 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
| 200 | } |
|
| 201 | $this->datastore = $datastore; |
|
| 202 | $this->has_default_datastore = $set_as_default; |
|
| 203 | ||
| 204 | foreach ( $this->groups as $group ) { |
|
| 205 | $group->set_datastore( $this->get_datastore(), true ); |
|
| 206 | } |
|
| 207 | return $this; |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * Return a clone of a field with hierarchy settings applied |
|