Empty reply from db table

Hi, this is a test function, bevaus I always get an error in the normal environment.
The error message is:
Undefined property: Cake\ORM\Query::$name [APP/Controller\JournalsController.php, line 237]
If I use ->get($id) instaed of find it works. Crazy I have many selections with find, but this is the first one not working. Any suggestions?

public function testCapital() {
$accTable = TableRegistry::get(‘Accounts’);
$acc = $accTable->find()
->where([‘account_no’ => “P1001”])
->where([‘year’ => 2017]);
echo $acc->name;

    return $this->redirect(['action' => 'index']);

$acc is a query object, not an entity. Call ->first() to fetch the entity.

if the query may return more records try toArray() or foreach


Thanks for your help.
Now I am using a foreach loop and it is working fine.