Skip to content

Add descriptions and few fixes#70

Merged
romaninsh merged 11 commits intodevelopfrom
feature/add-descriptions
Jul 23, 2016
Merged

Add descriptions and few fixes#70
romaninsh merged 11 commits intodevelopfrom
feature/add-descriptions

Conversation

@DarkSide666
Copy link
Copy Markdown
Member

Mostly descriptions for methods and properties are added.
But there are a few fixes too - not much, but still.

namespace atk4\data;

/**
* Class description?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we even use this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, currently we don't use this interface anywhere. Can I delete it completely in this PR?

@romaninsh romaninsh merged commit 80c8441 into develop Jul 23, 2016
@romaninsh romaninsh deleted the feature/add-descriptions branch July 23, 2016 23:30
Comment thread src/Model.php
if (!is_array($defaults)) {
$defaults = ['master_field' => $defaults];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is causing a problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftJoin('table', 'field'); 

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's my mistake.
It looked that join() have same checking so I removed this "duplicated" one, but I didn't notice, that $defaults['weak'] = true; line which changes situation :(

romaninsh added a commit that referenced this pull request Jul 25, 2016
DarkSide666 pushed a commit that referenced this pull request Jul 25, 2016
* Fix problem introduced in pr #70

 #70 (comment)

* rename internal method

* implement isDirty()

* clean syntax.
DarkSide666 pushed a commit that referenced this pull request Jul 26, 2016
* Somewhere we forgot this. re-adding.

* $model->set('blah')  will set value to title field.

* save() can now combine set/save() by taking argument

* off-load insert() functionality to set()

* insert will return "id" instead of full model.

Because cloned models are not very reliable now.

* counter is part of dsql.

* Applied fixes from StyleCI

* fix some tests

* typo

* more tests

* style

* Add is_numeric

* More field validations

* Add more numeric field check

* style

* Implement hasOne() relationship ID binding.

* Applied fixes from StyleCI

* Implements intelligent model reloading after save()

* No need to complicate things.

* Add documentation

* Applied fixes from StyleCI

* Added afterUpdateQuery / afterInsertQuery

* Implement and document how to prevent default operations on active record

* remove outdated test (since it's no longer on readme)

* Added some really nice advanced topics.

* allow hasOne()->addField('foo'); (instead of saying foo twice)

* Applied fixes from StyleCI

* allow hasOne()->addField('foo'); (instead of saying foo twice)

* Applied fixes from StyleCI

* Improve exception catching in Persistence_SQL

* Use single-table update and single-table delete with where id=X

$m->save() invokes update with a fixed ID. Also it updates joined
tables separately. Because the record has been loaded successfully
before and will be reloaded after updates (in some cases) at a risk of
failed transaction, we don't have to invoke action here.

Action is more suited for all-set update and if you use joins with
SQLite you're on your own, as it does not support join with update.

Same goes for deletion.

* Remove commented out code.

* Expanded documentation.

* merge feature/allow-updating-id

* Revert "merge feature/allow-updating-id"

This reverts commit 77733ae.

* First we need ability to avoid field persistence

If model is saving field and join is saving on top, we get problem.

* Remove misleading test.

No manual tweaking of related values (until we can figure out how to do
it safely, through join)

* avoid clash between join and field save.

* Refactor SQL persistence to use save_buffer()

* implement afterUnload hook.

* make use of afterUnload correctly.

* still call update() on persistence if joins are dirty.

* do everything except actual query if no fields are changed.

* adjust test to verify unloading and changing only joined field.

* Fix problem introduced in pr #70

 #70 (comment)

* rename internal method

* implement isDirty()

* clean syntax.

* fix bug in docs.

* allow addFields(['foo','bar']) without associations.

* Validation improvement.

* addCondition('foo', ['a','b']); shouldn't touch default.

* style.

* Add support for array in $this->model

* add support for array/model definition.

* implement hasOne('foo_bar', ['class', 'default'=>123]);

* if table has alias, prepend it to sub-select aliases.

* ref('has_one_id') will no longer add weird condition if it's not loaded.

* Update test-scripts

* Style.

* style.
DarkSide666 pushed a commit that referenced this pull request Aug 1, 2016
* Somewhere we forgot this. re-adding.

* $model->set('blah')  will set value to title field.

* save() can now combine set/save() by taking argument

* off-load insert() functionality to set()

* insert will return "id" instead of full model.

Because cloned models are not very reliable now.

* counter is part of dsql.

* Applied fixes from StyleCI

* fix some tests

* typo

* more tests

* style

* Add is_numeric

* More field validations

* Add more numeric field check

* style

* Implement hasOne() relationship ID binding.

* Applied fixes from StyleCI

* Implements intelligent model reloading after save()

* No need to complicate things.

* Add documentation

* Applied fixes from StyleCI

* Added afterUpdateQuery / afterInsertQuery

* Implement and document how to prevent default operations on active record

* remove outdated test (since it's no longer on readme)

* Added some really nice advanced topics.

* allow hasOne()->addField('foo'); (instead of saying foo twice)

* Applied fixes from StyleCI

* allow hasOne()->addField('foo'); (instead of saying foo twice)

* Applied fixes from StyleCI

* Improve exception catching in Persistence_SQL

* Use single-table update and single-table delete with where id=X

$m->save() invokes update with a fixed ID. Also it updates joined
tables separately. Because the record has been loaded successfully
before and will be reloaded after updates (in some cases) at a risk of
failed transaction, we don't have to invoke action here.

Action is more suited for all-set update and if you use joins with
SQLite you're on your own, as it does not support join with update.

Same goes for deletion.

* Remove commented out code.

* Expanded documentation.

* merge feature/allow-updating-id

* Revert "merge feature/allow-updating-id"

This reverts commit 77733ae.

* First we need ability to avoid field persistence

If model is saving field and join is saving on top, we get problem.

* Remove misleading test.

No manual tweaking of related values (until we can figure out how to do
it safely, through join)

* avoid clash between join and field save.

* Refactor SQL persistence to use save_buffer()

* implement afterUnload hook.

* make use of afterUnload correctly.

* still call update() on persistence if joins are dirty.

* do everything except actual query if no fields are changed.

* adjust test to verify unloading and changing only joined field.

* Fix problem introduced in pr #70

 #70 (comment)

* rename internal method

* implement isDirty()

* clean syntax.

* fix bug in docs.

* allow addFields(['foo','bar']) without associations.

* Validation improvement.

* addCondition('foo', ['a','b']); shouldn't touch default.

* style.

* Add support for array in $this->model

* add support for array/model definition.

* implement hasOne('foo_bar', ['class', 'default'=>123]);

* if table has alias, prepend it to sub-select aliases.

* ref('has_one_id') will no longer add weird condition if it's not loaded.

* Update test-scripts

* Style.

* style.

* dont query nonpeersistable fields

* add more advanced docs

* style

* style

* can have some advanced uses

* Add 2 more advanced topic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants