Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to disable auto assign #444

Merged
merged 1 commit into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ In order to read more about upgrading and BC breaks have a look at the [UPGRADE
+ [#264](https://github.com/luyadev/luya-module-admin/issues/264) Added new `readonly` option to NgRest Plugins which will render the list value in update scope.

### Fixed

+ [#439](https://github.com/luyadev/luya-module-admin/issues/439) Add option to dissabled auto assign of select data after find.
+ [#441](https://github.com/luyadev/luya-module-admin/issues/441) Fixed switching of the "check_circle" text to the real icon after successful authentication
+ [#435](https://github.com/luyadev/luya-module-admin/issues/435) Problem when clicking on checkboxes when initvalue is true (active) state.
+ [#426](https://github.com/luyadev/luya-module-admin/issues/426) Fixed a bug where color plugin does not work when model is empty.
Expand Down
12 changes: 12 additions & 0 deletions src/ngrest/plugins/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ abstract class Select extends Plugin
*/
public $emptyListValue = "-";

/**
* @var boolean If enabeld, which is default, the selected value will be automaticcaly assigned with the model attribute and override its default
* value from the database. This might be a problem when working with relations.
* @see https://github.com/luyadev/luya-module-admin/issues/439
* @since 3.0.0
*/
public $assignAfterFind = true;

/**
* Getter method for data array.
*
Expand Down Expand Up @@ -92,6 +100,10 @@ public function serviceData($event)
*/
public function onAfterListFind($event)
{
if (!$this->assignAfterFind) {
return parent::onAfterListFind($event);
}

$value = StringHelper::typeCast($event->sender->getAttribute($this->name));

if ($this->scheduling) {
Expand Down