@@ 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 |
@@ 188-199 (lines=12) @@ | ||
185 | * |
|
186 | * @param Datastore_Interface $datastore |
|
187 | */ |
|
188 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
189 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
190 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
191 | } |
|
192 | $this->datastore = $datastore; |
|
193 | $this->has_default_datastore = $set_as_default; |
|
194 | ||
195 | foreach ( $this->groups as $group ) { |
|
196 | $group->set_datastore( $this->get_datastore(), true ); |
|
197 | } |
|
198 | return $this; |
|
199 | } |
|
200 | ||
201 | /** |
|
202 | * Return a clone of a field with hierarchy settings applied |