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

[eluser]helmutbjorg[/eluser]
Try this?

Proyect model: $has_one = array(‘status’);
Status model: $has_many = array(‘proyects’);

[eluser]damarev[/eluser]
Yes... doesnt work. I have tried this too:

PROYECT:
var $has_one = array(
array('name' => 'client', 'table' => 'clients', 'fk' => 'client_id'),
array('name' => 'status', 'table' => 'statuses', 'fk' => 'status_id'),
);

STATUS
var $has_many = array(
array('name' => 'proyect', 'table' => 'proyects', 'fk' => 'status_id')
);

[eluser]damarev[/eluser]
Made it!

STATUS model relations:

Code:
class Status extends IgnitedRecord {
    var $has_many = array(
        array('name' => 'proyect', 'table' => 'proyects')
    );


PROYECT model relations:

Code:
class Proyect extends IgnitedRecord {
    var $belongs_to = array(
        array('name' => 'status', 'table' => 'statuses')
    );


And don't forget this in your controller:

Code:
$this->load->model(array('proyect','status'));
$this->proyect->join_related('status');

[eluser]m4rw3r[/eluser]
@damarev:
The problem you have is there because IR uses CI's inflector (and it does have problems with some words)

@ardinotow:
The form builder is quite basic, and it needs a lot of improvements (ajax, more customizable, etc.)-
When I have time and ideas, I'll rework / add to the form builder.

@all:
I'm quite busy with school and work for now, but I will hopefully get some time to work on IR soon.
Status of the writing of the new manual: about 30-40%.

[eluser]damarev[/eluser]
thanks m4rw3r. im having fun with CI, mainly beacause ignitedrecord its great!

[eluser]m4rw3r[/eluser]
There are some improvements to Ci's inflector here on the forum, but you can also write some IR specific code yourself (replace the code in the IR_base class, IR_base:Confusedingularize() and IR_base::pluralize())

[eluser]ardinotow[/eluser]
Ok m4rw3r, I'll waiting for the improvement on ajax. Can you mention how secure is your database on Cross Site Scripting filter issue? Thx...

[eluser]m4rw3r[/eluser]
IgnitedQuery (and therefore also IgnitedRecord) should be equivalent with CI's ActiveRecord when it comes to escaping.
And I must say that XSS != SQL injections.

So it won't help you with protection from Cross site scripting (use htmlspecialchars(), input filtering and similar), but it makes it possible to save html and javasctipt in the db without fear of db errors Tongue.

[eluser]MisterX[/eluser]
Hello, i have a problem ...

This is my models:

Code:
class news_cat extends IgnitedRecord{
    public $table='news_cat';
    public $has_many =array('table'=>'news_cat_lang','name'=>'news_cat_lang','fk'=>'nc_id');

}

Code:
class news_cat_lang extends IgnitedRecord{
    var $table='news_cat_lang';
    var $id_col='nc_id';
}
This is my database:

Code:
| news_cat       |
|id | name       |
------------------
| 1 | Test cat   |


| news_cat_lang         |
|nc_id| title | lang_id |
-------------------------
| 1   | UA Cat| 1       |
| 1   | RU Cat| 2       |

This is my controller:

Code:
$this->load->model('news_cat');
$this->load->model('news_cat_lang');
$d=$this->news_cat->find(1)->related('news_cat_lang')->get();
print_r($d);

It may be return 2 records, but i have:

Code:
Array
(
    [s:1:"1";] => IR_record Object
        (
            [__instance] => news_cat_lang Object
                (
                    [table] => news_cat_lang
                    [id_col] => nc_id
                    [columns] =>
                    [child_class] => IR_record
                    
            //Many vars empty vars
                )

            [__table] => news_cat_lang
            [__id] => 1
            [__data] => Array
                (
                    [nc_id] => 1
                    [title] => UA Cat
                    [lang_id] => 1
                )

            [__no_escape_data] => Array
                (
                )

            [nc_id] => 1
            [title] => UA Cat
            [lang_id] => 1
        )

)

What is wrong?

[eluser]m4rw3r[/eluser]
I think your id_col (Primary Key) definition is wrong for the news_cat_lang, because IR uses that key(s) as the uid for the row (identical uids = collision - resulting in a single row per uid)

I believe you should have array('nc_id', 'lang_id').
(But note that you'll have problems with relating from that table to the other ones, but the relations to it won't be a problem)




Theme © iAndrew 2016 - Forum software by © MyBB