@@ 553-564 (lines=12) @@ | ||
550 | * @param Datastore_Interface $datastore |
|
551 | * @return object $this |
|
552 | */ |
|
553 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
554 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
555 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
556 | } |
|
557 | $this->datastore = $datastore; |
|
558 | $this->has_default_datastore = $set_as_default; |
|
559 | ||
560 | foreach ( $this->fields as $field ) { |
|
561 | $field->set_datastore( $this->get_datastore(), true ); |
|
562 | } |
|
563 | return $this; |
|
564 | } |
|
565 | ||
566 | /** |
|
567 | * Get the DataStore instance |
@@ 147-156 (lines=10) @@ | ||
144 | * @param boolean $set_as_default |
|
145 | * @return object $this |
|
146 | */ |
|
147 | public function set_datastore( Datastore_Interface $datastore, $set_as_default = false ) { |
|
148 | if ( $set_as_default && ! $this->has_default_datastore() ) { |
|
149 | return $this; // datastore has been overriden with a custom one - abort changing to a default one |
|
150 | } |
|
151 | $this->datastore = $datastore; |
|
152 | $this->has_default_datastore = $set_as_default; |
|
153 | ||
154 | $this->update_child_datastore( $this->get_datastore(), true ); |
|
155 | return $this; |
|
156 | } |
|
157 | ||
158 | /** |
|
159 | * Propagate the datastore down the hierarchy |