Welcome Guest, Not a member yet? Register   Sign In
DMZ 1.7.1 (DataMapper OverZealous Edition)

[eluser]sideshowbob[/eluser]
DMZ 1.7.1 download: http://www.mediafire.com/file/z5izzjnaway/DMZ_1.7.1.zip

[eluser]The Hamburgler[/eluser]
Thanks for the link, I've created a repo on GitHub too. I'll try and keep it updated with each new release.

http://github.com/th3hamburgler/Datamapper-DMZ

I don't think the project is gone. I'd imagine it's just a server error and OZ is busy with life and stuff!

[eluser]sa3m[/eluser]
Thank you very much !!

[eluser]GameFret[/eluser]
Anyone have the documentation backed up by chance? Smile

Edit: Facepalm. Nevermind. It's in the repo.

[eluser]OverZealous[/eluser]
Hey everyone. I just had some connectivity issues. The site's back up.

(Sheesh - it was only like a day-and-a-half ;-)

[eluser]GameFret[/eluser]
Ah Phil, that just means you are loved. Wink

[eluser]The Hamburgler[/eluser]
I've searched this thread and haven't found anything so apologies if this has already been discussed.

Example: I have two models, Customer & Brand. They have a many_to_many relationship.

I want to run a query that returns all Brands and has a flag/count if each brand is already linked with a given Customer. The query should also be able to order Brands by those already linked/not linked.

I'm looking for something like include_related_count but i need to be able to specify a specific related record and also return records not related.

Thanks.

[eluser]introvert[/eluser]
Hello,

I'm wondering how it is possible to set WHERE condition when using include_related_count in such case:

Code:
$keywords = new Keyword();
$keywords->include_related_count('image');
$keywords->where('image_count <', 3);
$keywords->get();

Is this possible?

[eluser]OverZealous[/eluser]
@The Hamburgler
I don't know how you would do that with normal SQL, but I'm guessing you would need to build up a subquery. DMZ support subqueries, so it's just a matter of being creative. The subquery example in the manual is actually pretty close to what you want.

@introvert
The (poorly named on my part) include_related_count method is a SELECT element, and therefore cannot be used in the WHERE part of a query. (This is part of the SQL design.) However, it's simply a subquery, so you should be able to build up your own subqery and use it in a where statement. If necessary, you can look at the source code for the include_related_count method to see how to build your own subquery.

[eluser]Roobiz[/eluser]
[quote author="Roobiz" date="1275439174"]Hi guys,

I have two models, Post and Category. Post have many relationship on Category, and Category have many relationship on Post.

Is there a way to get all post without Category?

I tried (without any hope) to make that:

$oCat = new Category();
$oCat->get();

$oPost = new Post();
$oPost->where_not_in_related($oCat);

Thanks Smile[/quote]

Nothing for that ? Smile




Theme © iAndrew 2016 - Forum software by © MyBB