-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for using a custom Date class #532
Changes from 1 commit
03aff58
afb332e
637efd1
a5bfee0
532a394
000cf06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* @package ActiveRecord | ||
*/ | ||
namespace ActiveRecord; | ||
|
||
/** | ||
* Interface for Date classes that can be linked to to a model attribute. This is used by | ||
* ActiveRecord\DateTime so it can flag the model as dirty via $model->flag_dirty() when one of its | ||
* setters is called. | ||
* | ||
* @package ActiveRecord | ||
* @see http://php.net/manual/en/class.datetime.php | ||
*/ | ||
interface DateTimeLinkedModelInterface | ||
{ | ||
/** | ||
* Indicates this object is an attribute of the specified model, with the given attribute name. | ||
* | ||
* @param Model $model The model this object is an attribute of | ||
* @param string $attribute_name The attribute name | ||
* @return void | ||
*/ | ||
public function attribute_of($model, $attribute_name); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,4 +82,4 @@ | |
}); | ||
|
||
error_reporting(E_ALL | E_STRICT); | ||
?> | ||
?> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is unrelated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, that's been fixed. Let me know when/if you'd like me to squash these commits into one. Have you considered adding a .editorconfig file? That would prevent these sorts of issues. I can enter another PR with one if that sounds like something you'd like to see. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case editorconfig is unrelated, because this wouldn't have been edited anyway :) Even though if we would add a editorconfig, it would be set to insert a newline, which then will gradually roll out through. So yeah I'm pro-editorconfig. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #534 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double
instanceof
has been introduced just recently, and according to a (not so scientific?) benchmark theinstanceof
was performing better thanget_class
with string comparison.See that conversation here: #531 (comment)