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

Forums OroCRM OroCRM – How do I? Questions How to use date range?

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

  • Creator
  • #57929


    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
  • #57930
    Mike Kudelya
    Mike Kudelya


    I think you should use oro_type_widget_date_range:



    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?



    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?



    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?



    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.

    Mike Kudelya
    Mike Kudelya


    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 ?



    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.

You will be redirected to [title]. Would you like to continue?

Yes No