ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 7 replies, has 2 voices, and was last updated by  abel 1 year, 2 months ago.

  • Creator
    Topic
  • #22462

    abel
    Participant

    I want add and get value from date range.
    Use it in my bundle and show like that:

    How can do that?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #22495
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    I think you should use oro_type_widget_date_range:

    #22778

    abel
    Participant

    I was used dateRange follow your answer, I can create form and save data date range to database.
    But if I use it for filter data then some problem was occurred.
    I use date range follow CampaignBundle.
    ***** My code include:
    1. Function in Controller

    2. Provider

    ******* my date_range data like this:

    ********* ISSUE
    When I dump data ($result), in my interface show 2 notice

    And data are not filtered.
    The same when I change date_range to ‘this month’ or somthing (not have end_date and start_date)
    What wrong in my code?

    #22799

    abel
    Participant

    Update!!!
    I had read class Oro\Bundle\DashboardBundle\Filter\DateFilterProcessor
    function getModifiedDateData(array $dateData) have this code

    so I think $dateData have construct like that

    and after that, $dateData construct was converted to

    finally, it’s return

    But my dateRange data have construct

    So I think I need change this function, then I create new class DateFilterProcessor and class DateRangeFilter in direct Filter in my bundle. Next I was changed service.yml
    After that, it’s work true if I choose date range “Custom” (With between or laterthan or earlierthan), but when I choose different date range (‘today’, ‘this week’, ‘this month’, ‘this quarter’, ‘this year’), it’s not filter and no error.
    How can I fix it?

    #22813

    abel
    Participant

    I was dumped array date range of widget Campaigns By Close Revenue, and this is result

    It’s not like my date range when I save in database. But I couldn’t found where this function call

    Then how can I convert my date range to array as above?

    #22818

    abel
    Participant

    I was found function getConvertedValue() in class Oro\Bundle\DashboardBundle\Provider\Converters\FilterDateRangeConverter, that function convert data date range to array like last comment.
    I call this function with my dateRange and 3 parameter array null. I think it’s not best idea but still now, it’s work fine :)
    But I have different question:
    When I use Entity Repository, I create function for return 1 queryBuilder but when I call this function to use, my IDE show error cant not found in \Doctrine\Common\Persistence\ObjectRepository. What happend there?
    My code include:
    Entity Repository:

    And where I call function:

    I was followed code in core.

    #22878
    Mike Kudelya
    Mike Kudelya
    Oro Core

    Hi,

    Can you show me please more detailed error message with stack trace? Also i want to know content of getOrderRepository() function.

    Does your order entity contain @ORM\Entity(repositoryClass=”Oro\Bundle\EmailBundle\Entity\Repository\EmailRepository”) annotation ?

    #22892

    abel
    Participant

    Right, I’m not have annotation @ORM\Entity(repositoryClass=”Oro\Bundle\EmailBundle\Entity\Repository\EmailRepository”) in my entity class.
    Thanks for reply!

Viewing 7 replies - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.