# |
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 |
# |
Jan 6th 2020, 15:57 |
gianmarxgagliardi |
on the guide I had found this example |
# |
Jan 6th 2020, 15:54 |
ricksaccous |
get returns an entity |
# |
Jan 6th 2020, 15:54 |
ricksaccous |
you have an entity |
# |
Jan 6th 2020, 15:54 |
ricksaccous |
because you don't have a query object |
# |
Jan 6th 2020, 15:52 |
slackebot |
<gianmarxgagliardi> |
# |
Jan 6th 2020, 15:51 |
gianmarxgagliardi |
I would like to compare the underlined fields in order to take only the players who are associated with a certain id and not all the players |
# |
Jan 6th 2020, 15:49 |
slackebot |
$q->where(['SeasonPlayers.club_id' => ($matchHome->club_home_id)]); });``` |
# |
Jan 6th 2020, 15:49 |
gianmarxgagliardi |
```$matchHome = $this->Matches->get($id, [ 'contain' => ['SeasonReferees','SeasonReferees.Referees', 'ClubsHome', 'MatchPlayers','MatchPlayers.SeasonPlayers','MatchPlayers.SeasonPlayers.Players'], ]); $query = $matchHome->find(); $query->matching('MatchPlayers.SeasonPlayers', function ($q) { return |
# |
Jan 6th 2020, 15:49 |
gianmarxgagliardi |
I'm trying to get his players selected for a team that just gives me a mistake: `Call to undefined method App\Model\Entity\Match::find()` |
# |
Jan 6th 2020, 15:49 |
luizcmarin |
I have some views created on mysql. Can I use them the same way as a normal table in cake? |
# |
Jan 6th 2020, 15:41 |
etibor |
interestingly in the '[original]' array its shows the request->getData('visible') value the issue is that is not saved |
# |
Jan 6th 2020, 15:37 |
etibor |
i dont understand why this not working in edit function but in add working fine |
# |
Jan 6th 2020, 15:33 |
etibor |
thats why i havent post the request->getData content |
# |
Jan 6th 2020, 15:32 |
etibor |
@ndm well i would like to use this : $tst->_joinData->visible = $this->request->getData('visible'); |
# |
Jan 6th 2020, 15:32 |
ndm |
Could be all sorts of things... Maybe something changes the layout at `beforeRender` |
# |
Jan 6th 2020, 15:31 |
alexdd55976 |
any idea what could possibly interfer with that? |
# |
Jan 6th 2020, 15:31 |
ndm |
No |
# |
Jan 6th 2020, 15:30 |
alexdd55976 |
not really? |
# |
Jan 6th 2020, 15:30 |
alexdd55976 |
do i have to add a helper here? |
# |
Jan 6th 2020, 15:30 |
ndm |
@alexdd55976 Work's fine for me |