find & findOne deprecated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • onepoint0
    Member
    • Jul 2023
    • 46

    #1

    find & findOne deprecated

    Hi Devs,

    I have been successfully getting data like this until recently

    PHP Code:
            $purchaseRepo $this->entityManager->getRDBRepository('MmxPurchase');
      
            
    $purchase $purchaseRepo
            
    ->where(['name' => $orderNo])
            ->
    findOne(); 
    but I'm now getting a warning that find and findOne are deprecated. I can see in this git issue it says to "use building instead".


    I attempted the same thing with the example described in the Select Builder page in the doco, but am still getting the deprecation message on find():

    PHP Code:
    $selectBuilder $this->selectBuilderFactory->create();

    $query $selectBuilder
        
    ->from('MmxPurchase')
        ->
    withStrictAccessControl() // applies ACL
        // ->withSearchParams($searchParams) // search parameters passed from the frontend
        
    ->build();

    $collection $this->entityManager
        
    ->getRDBRepository('MmxPurchase')
        ->
    clone($query)
        ->
    find(); 

    I don't know if the Select Builder example above is what "use building instead" refers to. Can anyone please help me with how to do this?

    Thanks,
    Clare
    Last edited by onepoint0; Yesterday, 12:33 AM.
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9544

    #2
    It's not deprecated. Passing an argument to the find and findOne methods has been deprecated for a while and removed.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...