Thank you, that did it!
-- Best Regards,
Frank
On Monday, December 1, 2014 1:22:46 AM UTC-5, Dakota wrote:
On Monday, December 1, 2014 1:22:46 AM UTC-5, Dakota wrote:
Hey Frocco,In CakePHP 3, the entity properties for related entities are named according to the type of relation. BelongsTo and HasOne become lowercased_and_singular, whilst HasMany and BelongsToMany become lowercased_and_plural.It looks like Products BelongsTo Brands, so you need to use $row->brand->image_path. See http://book.cakephp.org/3.0/en/orm/table-objects.html# belongsto-associations
On Monday, 1 December 2014 01:39:14 UTC+2, frocco wrote:Hello,I took advice on these forums and decided to learn Cake 3.0 instead of 2.In my controller I am getting product items and trying to reference child table brands.$data = $this->Products->find('all')->where(['Products.is_active' => 0])->where(['Products.attributes LIKE' => $size.'%'])->where(['Products.category_id =' => $catid])->contain(['Brands']);foreach($products as $row):$row->Brands->image_path; // this line is causing an errorTrying to get property of non-object
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment