I have one cronjob needs to update status periodically.
Target table name is "Custom"
if custom table contain customid, user_id, status, exp_date columns.
I have scheduler php file call "custom.php".
I added below in __construct(
use Test\Subscription\Model\ResourceModel\Custom\CollectionFactory
public function __construct(
CollectionFactory $collectionFactory
) {
$this->collectionFactory=$collectionFactory;
}
public function execute() {
$custom_obj = $this->collectionFactory->create();
$custom_obj->addFieldToSelect('*')->load();
$items = $custom_obj->getItems();
foreach($items as $key=>$item){
if( date("Y-m-d") > $item->getDataByKey("exp_date") ) {
// save column
}
}
}
In this case does anyone know how to update column for this case ( to fill save column )? Also, Does anyone know best practice for this kind of case for update?
Thank you!