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