@@ 592-603 (lines=12) @@ | ||
589 | * @param Datastore_Interface $datastore |
|
590 | * @return Container $this |
|
591 | */ |
|
592 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
593 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
594 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
595 | } |
|
596 | $this->datastore = $datastore; |
|
597 | $this->has_default_datastore = $set_as_default; |
|
598 | ||
599 | foreach ( $this->fields as $field ) { |
|
600 | $field->set_datastore( $this->get_datastore(), true ); |
|
601 | } |
|
602 | return $this; |
|
603 | } |
|
604 | ||
605 | /** |
|
606 | * Get the DataStore instance |
@@ 159-168 (lines=10) @@ | ||
156 | * @param boolean $set_as_default |
|
157 | * @return self $this |
|
158 | */ |
|
159 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
160 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
161 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
162 | } |
|
163 | $this->datastore = $datastore; |
|
164 | $this->has_default_datastore = $set_as_default; |
|
165 | ||
166 | $this->update_child_datastore( $this->get_datastore(), true ); |
|
167 | return $this; |
|
168 | } |
|
169 | ||
170 | /** |
|
171 | * Propagate the datastore down the hierarchy |