Welcome Guest, Not a member yet? Register   Sign In
datamapper many to many
#1

[eluser]bralens[/eluser]
Code:
$categories = new Category();
$categories->where('public', 1)->get();

$post = new Post();
$post->title = $this->input->post('title');
$post->save($categories->all);

This code check if in join_Categories_Posts table already exists relation, but don't make new one if there is no relation.


Messages In This Thread
datamapper many to many - by El Forum - 01-18-2012, 06:05 AM
datamapper many to many - by El Forum - 01-18-2012, 06:37 AM
datamapper many to many - by El Forum - 01-18-2012, 08:31 AM
datamapper many to many - by El Forum - 01-18-2012, 08:46 AM
datamapper many to many - by El Forum - 01-18-2012, 09:12 AM
datamapper many to many - by El Forum - 01-18-2012, 11:49 AM
datamapper many to many - by El Forum - 01-18-2012, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB