forked from vlucas/phpDataMapper
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Fixed relations tests and did some initial setup for an idea o…
…n HasMany:through relations
- Loading branch information
Showing
5 changed files
with
69 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
/** | ||
* Blog Tags Mapper | ||
* Relates tags to blog posts through proxy table | ||
*/ | ||
class Fixture_Blog_Tags_Mapper extends TestMapper | ||
{ | ||
protected $source = 'test_blog_tags'; | ||
|
||
public $post_id = array('type' => 'int', 'primary' => true, 'serial' => true); | ||
public $tag_id = array('type' => 'int', 'key' => true); | ||
|
||
public $post_tags = array( | ||
'type' => 'relation', | ||
'relation' => 'HasMany', | ||
'mapper' => 'Fixture_Tag_Mapper', | ||
'where' => array('tag_id' => 'entity.tag_id') | ||
); | ||
|
||
/* | ||
public $post = array( | ||
'type' => 'relation', | ||
'relation' => 'BelongsTo', | ||
'mapper' => 'Fixture_Blog_Mapper', | ||
'where' => array('post_id' => 'entity.post_id') | ||
); | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
/** | ||
* Tags Mapper | ||
*/ | ||
class Fixture_Tags_Mapper extends TestMapper | ||
{ | ||
protected $source = 'test_tags'; | ||
|
||
public $id = array('type' => 'int', 'primary' => true); | ||
public $name = array('type' => 'string', 'required' => true, 'unique' => true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters