Código PHP:
mi entidad de mi tabla AdvertisementsImagenes esta asiVer original
class AdvertisementsController extends AuthController{ public function publicadd() { $publicadd = $this->Advertisements->newEntity(); $advertisementimage = ['associated' => ['AdvertisementsImagenes' => ['name_imagen' => true]]]; if($this->request->is('post')){ $publicadd = $this->Advertisements->patchEntity($publicadd,$this->request->data); if ($this->request->data['AdvertisementImagene']['name_imagen']['error']==0) { $advertisementimage = $this->request->data['AdvertisementImagene']['name_imagen']['name']; new Folder(WWW_ROOT . 'anuncios',true,0755); $image->copy(WWW_ROOT . 'anuncios/'.$this->request->data['AdvertisementImagene']['name_imagen']['name']); } $publicadd->id_user = $this->Auth->user('id_user'); if ($this->Advertisements->save($publicadd,$advertisementimage)) { $this->Flash->success('Anuncio Publicado'); $this->redirect(['controller' => 'Home','action' => 'index']); } else { $this->Flash->error('Error al Publicar'); } } $this->set('advertisements',$publicadd); } }
Código PHP:
por favor ayuda porque ya no se que hacer Ver original
class AdvertisementImagen extends Entity{ protected $_accessible = [ '*' => true, 'id_advertisement' => false, ]; }