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

i wanna to display a post, and display its category in the View post .. but,

i have an error !

posts controller
function view($id){
   $data['post'] = $this->post->join_related('category')->find($id);
   $data['category'] = $data['post']->category;

The error
A PHP Error was encountered

Severity: Notice

Message: Undefined property: IR_RelProperty::$plural

Filename: ignitedrecord/ignitedrecord.php

Line Number: 1210

SELECT `category`.`id` AS `category_id`, `category`.`name` AS `category_name`, `category`.`permalink` AS `category_permalink`, `category`.`created_at` AS `category_created_at`, `category`.`updated_at` AS `category_updated_at`, `posts`.*
FROM `posts`
LEFT JOIN `categories` AS `category` ON posts.category_id = category.id
WHERE `posts`.`id` = '6'

the data got fine!, but this error.. i use now 1.0

Fixed that error, Belongs To relations didn't have a plural property but now they do Smile.

and its work fine now ;-)
thanks again and again for this GREAT library :-)

why save() return FALSE after inserting a new record .. I test it, and it always print FALSE

function create()
  $to_add = $this->category->new_record(
     array('name'=>$_POST['name'], 'permalink'=>$_POST['permalink'])
   echo $to_add->save()==TRUE ? 'TRUE' : 'FALSE';

and here's the SQL

0.0168  SHOW COLUMNS FROM `categories`
0.0043  INSERT INTO `categories` (`name`, `permalink`, `created_at`, `updated_at`) VALUES ('ab c', 'ab-c', '2008-11-14 21:52:08', '2008-11-14 21:52:08')


I had overlooked the fact that there is a need to fetch the affected_rows in IgnitedQuery::insert(), which made it return false when affected_rows() was called -> save() returns false upon inserts.
It is now fixed.

I've now finally made a working "Through" relationship type!
It is still unfinished, but it works!

// Example usage:

$this->group = IgnitedRecord::factory('groups');
$this->user = IgnitedRecord::factory('users');
$this->post = IgnitedRecord::factory('posts');





$g = $this->group->find(1);
$p = $this->post->find(1);

echo "<pre>";
A note though; because of the SQL 2003 spec, I haven't been able to get Has Many Through habtm + habtm working yet
(see comment in relproperty_through.php, lines 105-143, to see why, and I'm grateful for help)

Error handling isn't implemented either (when "used" relations are not found)

Added error handling to the Through Relationship type, and also added possibility to use join_related() with it.
So it is finished, for now (unless bugs manifest themselves Tongue)

HABTM + HABTM still does not work...

So now on to the form generation and manual (*sigh* a lot of work there...)

Are you going to make cascade deleting? And how soon will it be?
Ex: user has many tours, tour has many adults, when i wanna delete my user, i want to delete the full chain.


[eluser]Sander Versluys[/eluser]
Thanks agein for coding this great library. I love it! I'm using it for my next project. Will keep you posted if any bugs come along. I'm using the latest from svn. I will also take a look at the form generation thing...

About "real" cascading deletes:

Because I've abandoned CI's AR, it is done now! Smile
(actually very fun to code, with IgnitedQuery's subqueries and a sort-of recursion)

So now IgnitedRecord performs real cascades through a whole relation tree. It starts with the table "farthest away" (relation-wise) from the record which is being deleted, then it works its way towards that record eventually deleting it.
NOTE! Do not use "circular" cascades, or IgnitedRecord would end up in a loop!

I also touched up some parts of the code (making some hooks disappear, because similar find methods have been instructed to use find_by*() to fetch).

Theme © iAndrew 2016 - Forum software by © MyBB