Skip to content

Commit

Permalink
Modelo para consulta
Browse files Browse the repository at this point in the history
Este ejemplo hace uso del modelo para BDD creado aqui --> 3bb22b1

1.- Ejemplo de consulta de registro existentes en tabla pfay_contacts
2.- Consultamos url : http://magento240.local/contacts/test/index
    para poder ver el volcado de nuestro objeto filtrado por nombre
  • Loading branch information
PerezContrerasLuis committed Jan 20, 2022
1 parent 3bb22b1 commit 82ac3a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion code/Pfay/Contacts/Controller/Test/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public function execute()
/* $this->_view->loadLayout();
$this->_view->renderLayout(); */

$contact = $this->_objectManager->create('Pfay\Contacts\Model\Contact');
/* $contact = $this->_objectManager->create('Pfay\Contacts\Model\Contact');
$contact->setName('Paul Dupond');
$contact->save();
Expand All @@ -18,6 +18,12 @@ public function execute()
$contact = $this->_objectManager->create('Pfay\Contacts\Model\Contact');
$contact->setName('Jack Daniels');
$contact->save();
die('test'); */
$contactModel = $this->_objectManager->create('Pfay\Contacts\Model\Contact');
$collection = $contactModel->getCollection()->addFieldToFilter('name', array('like'=> 'Paul Ricard'));
foreach($collection as $contact) {
var_dump($contact->getData());
}
die('test');
}
}

0 comments on commit 82ac3a7

Please sign in to comment.