Lithium 101

Lithium101 is an unofficial community resource for the Lithium PHP framework indexing articles, tutorials, code snippets and libraries.

Libraries

Tracking 261 plugins, categorised and sorted. If you are the plugin owner you can edit the status and category.

Snippets

So far there are 54 Lithium related snippets. It's super easy to add your gists as snippets on the site, if there is anything you think might be interesting or helpful take a minute to share it.

Latest Activity

17 hours ago davidpersson pushed to UnionOfRAD/li3_docs

Rebrand.

  • README.md had +3 additions and -3 deletions.
2 days ago d1rk created a comment about an issue in UnionOfRAD/lithium

Model::save() should only save updated fields

I agree on @koushki for two reasons: 1. As a developer i expect that to happen 2. As a bad developer, i do not care and might blame the framework for that As an addition, as soon, as i notice that _updated_ fields are going to be tracked inside entity, it seems obvious that a save only updates changed fields. If that is not the case, it should be clearly stated, somewhere. Before i state something like that somewhere, i would change the default behavior to something, that does not need an explanation. d1rk
2 days ago koushki created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

No, i think both of them are related . if we fix issue #1121 we don't need to above changes. We can validate only fields that has changed if only we save them. In this solution if developer set `'required' => true` we validate this field even it didn't change. Also in this way we don't need to change document and it's clear. What's your opinion? koushki
2 days ago koushki created a comment about an issue in UnionOfRAD/lithium

Model::save() should only save updated fields

I believe framework should be trusty for enterprise projects. I think solving of this problem is important for version one. Maybe this happen in special cases, but if happened, it can be problematic because it make a logic error in project and it change data without ability of reversible. it's clear that is very hard to find source of this problem. koushki
4 days ago davidpersson created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

@koushki I don't think #1121 has to block this issue. Those issues are independent from each other. davidpersson
4 days ago davidpersson created a comment about an issue in UnionOfRAD/lithium

All fields embed in update query, even which they didn't change !

The current default behavior for SQL databases is to do a full replace instead of an incremental update when saving an existing entity having all fields. I agree that this is something which can/should be optimized. I don't agree about the severity of this missing feature. It becomes only a problem if you rely on the atomicity of updates _and_ have a high amount of concurrency _and_ retrieved all fields. This feature could be implemented in the `Database::update()` and `Database::create()` methods similar to how its done with `MongDb` using its own Exporter class. For this case we may not even need a dedicated exporter class unless there's more code involved. davidpersson
4 days ago koushki created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

@davidpersson ,@netable please don't merge this commit. I found a bigger bug in `Entity` and i reported in #1121 issue. after fixing #1121 issue, we can use better way for this case. koushki

All fields embed in update query, even which they didn't change !

hi, in updating entity data , all fields that are selected, even they which didn't change will embed into query and they will store their datas. <b>It is dangerous risk !!</b> to becoming more clear i explain this with belove sample. <em>in controller A:</em> ```php $user = Users::find(1); $user->balance = 10; $user->save(); ``` <em>in controller B:</em> ```php $user = Users::find(1); $user->name = 'test'; $user->save(); ``` <ol> <li>Request for A : select user 1 (id = 1, balance = 0, name = 'your name') <li>Request for B : select user 1 (id = 1, balance = 0, name = 'your name') <li>Request for A : change balance and save data in database (balance = 10, name = 'your name') <li>Request for B : change name and save data in database (balance = 0, name = 'test') </ol> in above sample, in item 4, request shouldn't change `balance` field because `balance` hasn't changed in this request. @nateabele , I checked Entity source code and found `_updated` property, also i found `18b6a8c58766` commit that you had changed `_updated` behaviour. I think after this commit above bug has happened.
5 days ago markwilde pushed to UnionOfRAD/li3_queue

Moved QueueTest into tests/cases/storage

Cleaned spacing

Updated testConfiguration() to assertNull instead of assertFalse Looking at Adaptable class, config returns NULL on no config, instead of false

Muted fsockopen connection errors on testing for beanstalk server Error messages not needed as tests already mention if server is not running

Removed tests which are covered by other class unit tests

Added space formatting

Added read and write method to MockQueue

Shortened QueueTest setup

Updates to QueueTest - Removed tearDown - Removed testConfiguration - Added testWriteNoConfig - Added testWrite

Initial work on AMQP adapter

Added new write/read/consume methods to storage/Queue

Updated read method in storage/Queue

Added testSimpleWrite for AMQP

Added testReadNoConfig and testRead to QueueTest

Updates to AMQP adapter

Added testSimpleRead to AMQPTest

Updated AMQPTest

Changed variable naming from $acknowledge to $messages

Refactored AMQP and fixed bugs

Added new tests

5 days ago davidpersson created a comment about an issue in UnionOfRAD/li3_queue

Added AMQP adapter & updated Beanstalk adapter

Please commit as you see fit directly once you have write access. davidpersson

Added AMQP adapter & updated Beanstalk adapter

I've created an adapter for AMQP and in doing so updated the way messages are handled allowing the return of a message object. Works similar to the way models return entities allowing you to confirm and requeue messages. In doing this I've also updated the Beanstalk adapter to work in the same way and made everything use native Lithium classes/format. Tests accompany both these adapters.
6 days ago davidpersson created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

@koushki Model::validates() would be the best place. davidpersson
6 days ago koushki created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

thanks everybody for your opinions, I changed previous way to confirmed way. @jails please check and give me your opinion. @davidpersson I wanted to change documents but i don't know where is better, I confused among: + `validates` property in `Model` + `validates` method in `Model` + `check` method in `Validator` koushki
6 days ago davidpersson pushed to UnionOfRAD/li3_docs

Use normal crumb sep.

6 days ago davidpersson pushed to UnionOfRAD/li3_docs

Humanize crumb titles.

7 days ago davidpersson pushed to UnionOfRAD/li3_docs

Fenced code markdown parsing.

8 days ago jails created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

Yup, I should be able to provide something the new W.E. ! jails
8 days ago davidpersson created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

Alright, @jails would you like to lead the implementation and work on it together @koushki? Granted you both would like to and have time. davidpersson
8 days ago nateabele created a comment about an issue in UnionOfRAD/lithium

error in save entity without all fields that is defined in model validate .

@davidpersson Yeah I'm pretty much in agreement with @jails. nateabele
8 days ago davidpersson pushed to UnionOfRAD/li3_docs

Lower heading level.

8 days ago davidpersson pushed to UnionOfRAD/li3_docs

Implement up and always show TOC.

8 days ago davidpersson pushed to UnionOfRAD/li3_docs

Cleanup markup.

8 days ago davidpersson pushed to UnionOfRAD/li3_docs

Lower heading count.