Compiling error CollectionFactory does not exist

Hello everyone! A total newbie here and I encountered a roadblock. I hope you could help me. I have exhausted my resources, but still failed. I’m currently studying Magento 2. I can’t seem to compile my own module because I’m always getting this error.

This is my actual code.

<?php

namespace Luz\Todo\Block;

use \Magento\Framework\View\Element\Template;
use \Magento\Framework\View\Element\Template\Context;
use \Luz\Todo\Model\ResourceModel\View\CollectionFactory as ViewCollectionFactory;
use \Magento\Customer\Model\Session;

class Todo extends Template
{
/**
* CollectionFactory
* @var null|CollectionFactory
*/
protected $_viewCollectionFactory = null;

/**
 * Constructor
 *
 * @param Context $context
 * @param ViewCollectionFactory $viewCollectionFactory
 * @param array $data
 */

protected $customerSession;

public function __construct(
    Context $context,
    ViewCollectionFactory $viewCollectionFactory,
    Session $customerSession,
    array $data = [],
) {
    $this->_viewCollectionFactory = $viewCollectionFactory;
    $this->customerSession = $customerSession;
    parent::__construct($context, $data);
}

public function getTasks()
{
    $customerId = $this->customerSession->getCustomerId();
    $viewCollection = $this->_viewCollectionFactory->create();
    $viewCollection->addFieldToFilter('customer_id', $customer_Id);

    return $viewCollection;
}

}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.