Welcome Guest, Not a member yet? Register   Sign In
SMC - Simple Model for CodeIgniter (CRUD)
#1

[eluser]alexwenzel[/eluser]
SMC (simple model for codeigniter) is a lightweight CRUD model for CodeIgniter.

Check out the Documentation on Bitbucket!

Download and Documentation


Submit Bugs and Issues


Examples


Code:
// INSERT data

$user           = new User();

$user->name     = 'new user';
$user->email    = '[email protected]';
$user->password = '123456';

$user->create();

// UPDATE data

$user = User::find('name', 'new user');

$user->password = 'new password';

$user->save();

// REMOVE data

$user = User::find('id', 1);

$user->remove();

// SELECT data

$users = User::query()->where('name', 'a user')->or_where('name', 'another user')->get();

// ITERATE RESULTS

foreach ($users as $user) {
        $user->name = 'a new name';
        $user->save();
}
#2

[eluser]Unknown[/eluser]
I like the concept...seems very useful : )
#3

[eluser]alexwenzel[/eluser]
[quote author="Th3Location" date="1347299204"]I like the concept...seems very useful : )[/quote]

First of all, thank you for the feedback. I hope you checked also my bitbucket wiki page for a full guide about this.

If you have any question regarding the use, or if you need some best practise examples dont hesitate to ask me.

The examples above are valid for version 1.0 of SMC.
#4

[eluser]alexwenzel[/eluser]
I updated SMC to version 1.1 and added some new features like:

- auto guess table name
- auto guess primary key
- __toString method
- model iteration
- ability for static method chaining
- save_new() method
#5

[eluser]PhilTem[/eluser]
Just had a quick glance at your code... And added two issues Tongue But they aren't any real issues but suggestions, which may enhance code readability, speed, and allowing others to easily use the model within their application(s) Wink
#6

[eluser]goFrendiAsgard[/eluser]
Very interesting. Make me remember of those django model.
This can be the "real ORM" I was searching for Smile
#7

[eluser]alexwenzel[/eluser]
[quote author="PhilTem" date="1349816545"]Just had a quick glance at your code... And added two issues Tongue But they aren't any real issues but suggestions, which may enhance code readability, speed, and allowing others to easily use the model within their application(s) Wink[/quote]

Thank you for your contributing. I added all your improvements and tagged a new version.

issue #1: advanced table guessing

Ability to guess the tablename even if you suffix your model with '_m' or '_model' (case insensitive)

issue #2: speed up __construct() method
#8

[eluser]alexwenzel[/eluser]
I massivly enhanced the SMC wiki. Have fun using it.
#9

[eluser]jojo777[/eluser]
This is very very cool dude! I'll check it and maybe I can append some other functions I usually need, but after a quick view looks awesome!

Thanks!
#10

[eluser]alexwenzel[/eluser]
[quote author="jojo777" date="1351242612"]This is very very cool dude! I'll check it and maybe I can append some other functions I usually need, but after a quick view looks awesome!

Thanks![/quote]

Would be very kind if you all post your experience with SMC.

I need some feedback to improve usability.




Theme © iAndrew 2016 - Forum software by © MyBB