# |
Jan 6th 2020, 16:22 |
ricksaccous |
read this |
# |
Jan 6th 2020, 16:22 |
ricksaccous |
https://book.cakephp.org/3/en/orm/retrieving-data-and-resultsets.html |
# |
Jan 6th 2020, 16:22 |
gianmarxgagliardi |
i have to compare club id |
# |
Jan 6th 2020, 16:21 |
ricksaccous |
i probably should not spoon feed you so much |
# |
Jan 6th 2020, 16:21 |
gianmarxgagliardi |
I do not understand |
# |
Jan 6th 2020, 16:21 |
ricksaccous |
Matches.id => $id |
# |
Jan 6th 2020, 16:21 |
ricksaccous |
and you set the where to be |
# |
Jan 6th 2020, 16:20 |
ricksaccous |
you keep the matching you had |
# |
Jan 6th 2020, 16:16 |
gianmarxgagliardi |
Unknown method "has" |
# |
Jan 6th 2020, 16:16 |
gianmarxgagliardi |
```$matchHome=$this->Matches->find() ->contain('SeasonReferees','SeasonReferees.Referees', 'ClubsHome', 'MatchPlayers','MatchPlayers.SeasonPlayers','MatchPlayers.SeasonPlayers.Players') ->where(['SeasonPlayers.club_id' => 3]);``` |
# |
Jan 6th 2020, 16:13 |
ricksaccous |
no not really you simply create a table class and set the table to the view and you should be fine |
# |
Jan 6th 2020, 16:12 |
luizcmarin |
* Any information about this in the manual? |
# |
Jan 6th 2020, 16:12 |
luizcmarin |
thanks you |
# |
Jan 6th 2020, 16:12 |
luizcmarin |
but what interests me most is displaying the data, so that's fine with me right now. |
# |
Jan 6th 2020, 16:10 |
ricksaccous |
it's mostly for reading conglomerated data |
# |
Jan 6th 2020, 16:10 |
ricksaccous |
i don't think you can update or delete from a view though |
# |
Jan 6th 2020, 16:10 |
ricksaccous |
you can select from a view |
# |
Jan 6th 2020, 16:10 |
ricksaccous |
yeah for you |
# |
Jan 6th 2020, 16:08 |
luizcmarin |
"yeah" for me, @ricksaccous? Show ! |
# |
Jan 6th 2020, 16:07 |
ricksaccous |
yeah |
# |
Jan 6th 2020, 16:07 |
luizcmarin |
I have some views created on mysql. Can I use them the same way as a normal table in cake? |
# |
Jan 6th 2020, 16:06 |
luizcmarin |
hi |
# |
Jan 6th 2020, 16:06 |
ricksaccous |
yeah because you have to do $this->Matches->find()->where(['']) |
# |
Jan 6th 2020, 16:03 |
gianmarxgagliardi |
with find `Unknown finder method "4"` |
# |
Jan 6th 2020, 16:00 |
gianmarxgagliardi |
in the controller Matches |
# |
Jan 6th 2020, 16:00 |
ricksaccous |
welp, good luck |
# |
Jan 6th 2020, 16:00 |
gianmarxgagliardi |
I'm implementing the view |
# |
Jan 6th 2020, 16:00 |
ricksaccous |
and the entity does not have the ::matching() method |
# |
Jan 6th 2020, 16:00 |
gianmarxgagliardi |
the get would help me to get id of the ennuple |
# |
Jan 6th 2020, 15:59 |
ricksaccous |
get() returns an entity |
# |
Jan 6th 2020, 15:59 |
ricksaccous |
and search where Matches.id => $id |
# |
Jan 6th 2020, 15:59 |
ricksaccous |
use find() |
# |
Jan 6th 2020, 15:59 |
gianmarxgagliardi |
`Call to undefined method App\Model\Entity\Match::matching()` |
# |
Jan 6th 2020, 15:59 |
ricksaccous |
just don't use get() |
# |
Jan 6th 2020, 15:59 |
gianmarxgagliardi |
```$matchHome = $this->Matches->get($id, [ 'contain' => ['SeasonReferees','SeasonReferees.Referees', 'ClubsHome', 'MatchPlayers','MatchPlayers.SeasonPlayers','MatchPlayers.SeasonPlayers.Players'], ])->matching('MatchPlayers.SeasonPlayers', function ($q) { return $q->where(['SeasonPlayers.club_id' => 3]); });``` |
# |
Jan 6th 2020, 15:58 |
gianmarxgagliardi |
if instead everything is compact |
# |
Jan 6th 2020, 15:58 |
ricksaccous |
```$query = $matchHome->find();``` |
# |
Jan 6th 2020, 15:58 |
ricksaccous |
your mistake is this line |
# |
Jan 6th 2020, 15:58 |
ricksaccous |
yeah that part is fine |
# |
Jan 6th 2020, 15:57 |
gianmarxgagliardi |
```// In a controller or table method. $query = $products->find()->matching( 'Shops.Cities.Countries', function ($q) { return $q->where(['Countries.name' => 'Japan']); } );``` |
# |
Jan 6th 2020, 15:57 |
gianmarxgagliardi |
https://book.cakephp.org/3/en/orm/retrieving-data-and-resultsets.html |