# getSchemaCollection() error

**URL:** <https://discourse.cakephp.org/t/getschemacollection-error/4405>\
**Category:** Need Help\
**Created:** [June 13, 2018, 6:21pm UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405 "2018-06-13T18:21:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrh10](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jrh10](https://discourse.cakephp.org/u/jrh10)\
**Post date:** [June 13, 2018, 6:21pm UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/1 "2018-06-13T18:21:30Z")

</div>

Hi

I am quite new to cake and ran through a tutorial and had everything working however i am developing for real now.

I have a database set-up and the cake intro page says i am connecting to it, however when i do a “cake bake” on a table i get the following errors.

2018-06-13 20:06:44 Error: [Error] Call to a member function getSchemaCollection() on null in C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\ORM\Table.php on line 547

I don’t usually like to ask for help but i have searched and search for info on getSchemaCollection and can’t find anything!

Jon

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [June 14, 2018, 3:41pm UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/2 "2018-06-14T15:41:15Z")

</div>

It literally means your app is trying to call `getSchemaCollection()` on something that doesn’t exist.  
What is the “exact” command you’re trying to use (eg. `cake bake model users`)?

---

<div class="post-metadata">

**Author:** ![jrh10](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jrh10](https://discourse.cakephp.org/u/jrh10)\
**Post date:** [June 15, 2018, 8:44am UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/3 "2018-06-15T08:44:42Z")

</div>

i was running

cake bake all Purchase

There is a purchase table in the db and indeed cake generate the table-\>model file but none of the other files

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [June 15, 2018, 9:33am UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/4 "2018-06-15T09:33:37Z")

</div>

Odd…  
And when you just run it again, it doesn’t change?  
If not, what is the output you get from the bake tool

---

<div class="post-metadata">

**Author:** ![jrh10](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jrh10](https://discourse.cakephp.org/u/jrh10)\
**Post date:** [June 15, 2018, 9:46am UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/5 "2018-06-15T09:46:28Z")

</div>

I get the following errors

* * *

One moment while associations are detected.  
Exception: Call to a member function getSchemaCollection() on null in [C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\ORM\Table.php, line 547]  
2018-06-15 11:45:46 Error: [Error] Call to a member function getSchemaCollection() on null in C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\ORM\Table.php on line 547  
Stack Trace:  
#0 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(415): Cake\ORM\Table-\>getSchema()  
#1 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(231): Bake\Shell\Task\ModelTask-\>findHasMany(Object(App\Model\Table\PurchaseTable), Array)  
#2 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(130): Bake\Shell\Task\ModelTask-\>getAssociations(Object(App\Model\Table\PurchaseTable))  
#3 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(113): Bake\Shell\Task\ModelTask-\>getTableContext(Object(App\Model\Table\PurchaseTable), ‘purchase’, ‘Purchase’)  
#4 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\Task\ModelTask.php(100): Bake\Shell\Task\ModelTask-\>bake(‘Purchase’)  
#5 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\BakeShell.php(272): Bake\Shell\Task\ModelTask-\>main(‘Purchase’)  
#6 C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\Collection\CollectionTrait.php(51): Bake\Shell\BakeShell-\>Bake\Shell{closure}(‘Purchase’, 0)  
#7 C:\xampp\htdocs\bookmarker\vendor\cakephp\bake\src\Shell\BakeShell.php(273): Cake\Collection\Collection-\>each(Object(Closure))  
#8 C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\Console\Shell.php(518): Bake\Shell\BakeShell-\>all(‘purchase’)  
#9 C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\Console\CommandRunner.php(342): Cake\Console\Shell-\>runCommand(Array, true)  
#10 C:\xampp\htdocs\bookmarker\vendor\cakephp\cakephp\src\Console\CommandRunner.php(164): Cake\Console\CommandRunner-\>runShell(Object(Bake\Shell\BakeShell), Array)  
#11 C:\xampp\htdocs\bookmarker\bin\cake.php(12): Cake\Console\CommandRunner-\>run(Array)  
#12 {main}

---

<div class="post-metadata">

**Author:** ![FinlayDaG33k](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/finlaydag33k/32/1049_2.png) [@FinlayDaG33k](https://discourse.cakephp.org/u/FinlayDaG33k)\
**Post date:** [June 18, 2018, 9:12am UTC](https://discourse.cakephp.org/t/getschemacollection-error/4405/6 "2018-06-18T09:12:20Z")

</div>

it means that for some reason you aren’t properly connecting.  
Are you sure the database exists with the tables you’re trying to bake?
