Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
add subquery to every find-statement in beforeFind
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mathias R  
View profile  
 More options Nov 2 2012, 11:10 am
From: Mathias R <frechda...@planet-smart-radio.de>
Date: Fri, 2 Nov 2012 08:10:33 -0700 (PDT)
Local: Fri, Nov 2 2012 11:10 am
Subject: add subquery to every find-statement in beforeFind

Hi,

i have a model which belongs to another like "model car belongs to
rent-time".
in table for rent-time there are two timestamps (start and end).
now i want to modify every find-statement for model car and add a subquery
like this:

select *, (select id from rent-time where start >= time() and end <= time()
and car_id = $car_id limit 0,1) as rent-time from car

is it possible to modify original statement to add a subquery?

M.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bs28723  
View profile  
 More options Nov 3 2012, 1:14 pm
From: bs28723 <bill.sto...@boosterwebsolutions.com>
Date: Sat, 3 Nov 2012 10:14:19 -0700 (PDT)
Local: Sat, Nov 3 2012 1:14 pm
Subject: Re: add subquery to every find-statement in beforeFind

    Since you may not want to do this for every find call for your
    model, you might want to setup a custom find type.
    Then you could either add additional conditions and nested
    conditions &amp; sub-queries to the original request, or possibly
    use the Model::query() call

    Check out this page for some examples
    http://book.cakephp.org/2.0/en/models/retrieving-your-data.html

    HTH,
    bill

    On 11/2/2012 11:11 AM, Mathias R [via
      CakePHP] wrote:

     Hi,

      i have a model which belongs to another like "model car belongs to
      rent-time".
      in table for rent-time there are two timestamps (start and end).
      now i want to modify every find-statement for model car and add a
      subquery like this:

      select *, (select id from rent-time where start &gt;= time() and
      end &lt;= time() and car_id = $car_id limit 0,1) as rent-time from
      car

      is it possible to modify original statement to add a subquery?

      M.
      --
      Like Us on FaceBook https://www.facebook.com/CakePHP
      Find us on Twitter http://twitter.com/CakePHP
      &nbsp;
      ---
      You received this message because you are subscribed to the Google
      Groups "CakePHP" group.
      To post to this group, send email to [hidden email] .
      To unsubscribe from this group, send email to [hidden email] .
      Visit this group at http://groups.google.com/group/cake-php?hl=en .
      &nbsp;
      &nbsp;

        If you reply to this email, your
          message will be added to the discussion below:
        http://cakephp.1045679.n5.nabble.com/add-subquery-to-every-find-state...

        To start a new topic under CakePHP, email
        ml-node+s1045679n125572...@n5.nabble.com  
        To unsubscribe from CakePHP, click
          here .
        NAML  

--
View this message in context: http://cakephp.1045679.n5.nabble.com/add-subquery-to-every-find-state...
Sent from the CakePHP mailing list archive at Nabble.com.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »