Welcome Guest, Not a member yet? Register   Sign In
IgnitedRecord 1.0 pre-release

[eluser]RIVO10[/eluser]
Hello, i'm starting with IgnitedRecord and ometimes i need to get a plain object from the query.
I added that function to te IR_Record class (model/ignitedrecord/record.php)
Code:
function plain()
{
    $obj = $this;
    unset($obj->__table);
    unset($obj->__id);
    unset($obj->__data);
    unset($obj->__instance);
    return (Object) $obj;
}

And later, using the query normally, adding the call to the function at the end:

Code:
//This line saves the plain result in the session, in the product model.
$this->session->set_userdata('product', $this->find('51')->plain() );

I think it could be useful to someone, but maybe this is not the best way to do it...

[eluser]m4rw3r[/eluser]
There is already a method in the IR_record class for this purpose (it returns an array, but whatever): get_data().

get_data() will fit perfectly for your usage (unless you have properties which are not stored in db).

(if you want an object use (Object) to cast the array to an object)

EDIT: your solution has two flaws, not removing behaviour helpers and problems with PHP 5

[eluser]dcunited08[/eluser]
I started using this library and, overall, I find it very user-friendly. I noticed that load_belongs_to does not load the model if it is not already loaded and changed it with a basic:
Code:
if(!isset($CI->$model))
{
   $CI->load->model($model, $model);    
}

I also put it in the library directory, it seemed to fit better there for me.

[eluser]m4rw3r[/eluser]
The 1.0 version will have a lot of improvements, both performance and usage related.
The API won't change much in 1.0, but the underlying structure of the code have been greatly improved which results in stability and speed improvements.

btw, in 1.0, it will ship in the libraries folder Smile

[eluser]fightbulc[/eluser]
Nice! Looking forward to. When can we expect it?

[eluser]m4rw3r[/eluser]
Well, there needs to be a lot of work on the manual before I can release it and also the validation and form generation needs to be polished.

So if anyone is interested in helping me out with the manual (proofreading, collaborating, etc.), I'd be grateful!

[eluser]___seb[/eluser]
Hi

I'm new to php framworks, so new to codeigniter (1 day of practice, tiny app made) and trying to get Ignited Record to work ...

Here is the error :

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Delicious::$db

Filename: ignitedrecord/base.php

Line Number: 192
---
Fatal error: Call to a member function get_where() on a non-object in /home/seb/htdocs/ci_smarty_record/system/application_record/models/ignitedrecord/base.php on line 192

my code is
model :
Code:
class Delicious extends IgnitedRecord
{
    var $has_and_belongs_to_many = 'tags';

    function Delicious()
    {

    }

    function test()
    {
    
    }

}
controler
Code:
class Links extends Controller {

    function Links() // constructeur : appellé a chaque fois
    {
        parent::Controller();
        $this->load->database();
        $this->load->orm();

        $this->load->model('ignitedrecord/ignitedrecord');
        $this->load->model('Delicious');

        $rec1 =& $this->Delicious->find(1);

    }
    
    function index($tags_inline = false, $page = 1) // appellé si pas d'action de définie
    {
        //echo 'ok ?';
        //$rec1 =& $this->Links->find(1);
    }
}

I guess it's something stupid...

[eluser]fightbulc[/eluser]
[quote author="m4rw3r" date="1225922311"]

So if anyone is interested in helping me out with the manual (proofreading, collaborating, etc.), I'd be grateful![/quote]

Hey Martin,

maybe I can help you out with the form class. I developed some time ago a form class which is quite sexy - in my opinion Smile So if you like I could help you with this part and put some extra ideas in it. Proofreading could be also done.

Let me know
Cheers
Tino

[eluser]m4rw3r[/eluser]
@__seb:
Your constructor does not call the parent constructor (parent::IgnitedRecord()), and the database object can therefore not be referenced.

So call parent::IgnitedRecord() in your constructor, or omit the constructor (if you don't need it, PHP will default to the parent constructor).

@fightbulc:
Thanks, I'd gladly hear you out, ideas are always appreciated!

[eluser]fightbulc[/eluser]
Can you pass me some information how you create the fields and how you implement them into the view?
From there on I can take a look and get back to you.




Theme © iAndrew 2016 - Forum software by © MyBB