Thanks for that , but as it got me closer to the Policy data it now does not
pull any Notifications that are external. Still just associated matching
records.
Never All Notifications that have a Policy.id based on Policy.status along
with all Notifications with no Policy.
Using:
'conditions' => array(
'Notification.user_id' => $me,
'OR' => array(
'Policy.status' => 0,
'Policy.status IS NULL')),
Thanks
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of ShadowCross
Sent: Thursday, February 17, 2011 1:18 AM
To: CakePHP
Subject: Re: Joins Conditions Contain Question
Try:
'conditions' => array(
'OR' => array(
'Policy.status' => 1,
'Policy.status IS NULL'
)
)
or for MySQL:
'conditions' => array(
'IFNULL(Policy.status, 1)' => 1
)
On Feb 16, 10:54 am, "Krissy Masters" <[email protected]>
wrote:
> Sorry I did not explain the Notifications better.
> If a Notification is made thru the form (external notification, not
related
> to a Policy on the site) then it has no policy_id Simply a record in the
> table with
> id so when the JOINS with POLICY happens all the external are
automatically
> forgot about since there are no POLICY records of any kind since its
> external. Nothing to join with.
>
> EXTERNAL:
> Id = > 123
> Policy_id = null
> Name => sdfsf
> ...other files
>
> INTERNAL
> Id = > 456
> Policy_id = 856-954-8
> ..every other field blank since the data is pulled from the policy_id
>
> Thanks,
>
> K
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
Behalf
>
> Of John Andersen
> Sent: Wednesday, February 16, 2011 4:23 AM
> To: CakePHP
> Subject: Re: Joins Conditions Contain Question
>
> Would it be possible to assign a status value of "Not applicable" (0)
> to the B notifications, thus you would be able to use a condition like
> Policy.status => array(0,1) AND Notification.user_id => $me
>
> or something similar :)
> Enjoy,
> John
>
> On 15 Feb., 22:27, "Krissy Masters" <[email protected]>
> wrote:
> > This WILL sound complicated.
>
> > Policy hasMany Notification / Notification belongsTo Policy
>
> > Now the Notification can be
>
> > A. internal (relating to specific content in the site, so the data
> is
> > gathered directly , created by logged in user, what page Policy it
> pertains,
> > other policy info, notification reason..)
>
> > B. external (then the user fills out a form) and this is
represented
> > by Notification.local table field bool
>
> > So now paginate Notifications easy enough until the JOINS condition
> > Notification.user_id => $me, Policy.status => 1.
>
> > Since external Notifications have no Policy.status those are not being
> > pulled obviously. This is where the problem is. I have to keep the
> > Policy.status for archive / record keeping legal mumbo jumbo so I simply
> can
> > not delete a Notification, has to be marked read, fixed, outstanding,
> > overdue.
>
> > And all Nofifications must be in 1 page (pagination). I tried making an
> > ExternalNotification model / controller but then I run into the issues
of
> > paginating 2 separate models as 1.
>
> > If there is a way to find by( Notification.user_id => $me,
Policy.status
> =>
> > 1) or (Notification.user_id => $me, Policy.status => does not exist?)
>
> > Some other method suggestion, point me in a general direction.
>
> > Thanks guys,
>
> > K
>
> --
> Our newest site for the community: CakePHP Video
Tutorialshttp://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
athttp://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php