Skip to content

Conversation

@nebulousGirl
Copy link
Contributor

Mapper now defaults to entities' scopes instead of empty array. The method scopes was already defined in Entity, but I don't think it was used from what I saw in the code.

Scopes can be used from relations:

//Get post with id 1, then its comments, then just yesterday's.
$yesterday_comments = $mapper->get(1)->comments->yesterday();

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use new \DateTime('yesterday') instead of date('Y-m-d H:i:s', strtotime('yesterday')) here so the database adapter can format the DateTime object however it needs to for comparison. Also, it's less typing :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the change: 4f07653

@vlucas
Copy link
Collaborator

vlucas commented Oct 19, 2015

Looks good. I'll check the noQuote issue in a separate issue/PR. 👍

vlucas added a commit that referenced this pull request Oct 19, 2015
@vlucas vlucas merged commit 6f6b3c5 into spotorm:master Oct 19, 2015
@nebulousGirl nebulousGirl deleted the scopes-enhancements branch November 1, 2015 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants