Skip to content
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

Include DateTime to ContentBehavior or use \DateTime #5716

Closed
Anubarak opened this issue Feb 25, 2020 · 2 comments
Closed

Include DateTime to ContentBehavior or use \DateTime #5716

Anubarak opened this issue Feb 25, 2020 · 2 comments

Comments

@Anubarak
Copy link
Contributor

Anubarak commented Feb 25, 2020

Description

The current generated ContentBehavior does not use DateTime; but generates

    /**
     * @var DateTime|null Value for field with the handle “startDate”.
     */
    public $startDate;

so the class DateTime cannot be resolved. Would you mind changing that, you only have to include the slash as you do it for other classes

    /**
     * @var \craft\elements\db\UserQuery Value for field with the handle “user”.
     */
    public $user;

I know the next thing actually belongs to a separate issue and is not related to the ContentBehavior, but to the ElementQueryBehavior but I'll mention it anyway. It has the properties

 * @method self headline(mixed $value) Sets the [[headline]] property

So when I do

Entry::find()->headline('foo')->all();

PHPStorm cannot resolve all because the behavior does not have such a method.
This can be fixed via

* @method \craft\elements\db\ElementQuery headline(mixed $value) Sets the [[headline]] property

So PHPStorm knows at least an ElementQuery is returned. Same goes for the new "merged" CustomFieldsBehavior

@brandonkelly
Copy link
Member

Whoops, thanks for pointing that out! Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 3.4.9 is out now with the fix for this. Note that you will need to delete your current CustomFieldBehavior.php file before the change will take effect.

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

No branches or pull requests

2 participants