Zend Framework Deleting through a data mapper module. - zend-framework

I am still having problems getting table relationships defined, and have just changed the relationship between users and comment classes as advised, but when I went to test I got a new error.
C:\wamp\www\megashare\application\models\UsersMapper.php
public function deleteUser($id, Default_Model_Users $users){
$usersTable = new Default_Model_DbTable_Users();
$usersRowset = $usersTable->find( $id );
$userToDelete = $usersRowset->current();
$userToDelete->delete();
}
Generates the following error:
Zend Error Type: EXCEPTION_OTHER
REQUEST_URI: /megashare/public/users/delete/userId/14
Stack trace:
#0 C:\wamp\www\megashare\application\models\UsersMapper.php(104): Zend_Db_Table_Row_Abstract->delete()
#1 C:\wamp\www\megashare\application\models\Users.php(761): Default_Model_UsersMapper->deleteUser(14, Object(Default_Model_Users))
#2 C:\wamp\www\megashare\application\controllers\UsersController.php(112): Default_Model_Users->deleteUser(14)
#3 C:\wamp\www\megashare\library\Zend\Controller\Action.php(512): UsersController->deleteAction()
#4 C:\wamp\www\megashare\library\Zend\Controller\Dispatcher\Standard.php(288): Zend_Controller_Action->dispatch('deleteAction')
#5 C:\wamp\www\megashare\library\Zend\Controller\Front.php(936): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#6 C:\wamp\www\megashare\library\Zend\Application\Bootstrap\Bootstrap.php(77): Zend_Controller_Front->dispatch()
#7 C:\wamp\www\megashare\library\Zend\Application.php(303): Zend_Application_Bootstrap_Bootstrap->run()
#8 C:\wamp\www\megashare\public\index.php(31): Zend_Application->run()
#9 {main}

I dont know why, but this error has stopped now. There is nothing wrong with the code in this sample. There are other issues which are not related to this question. Therefore consider this question answered. I think the underlying model class definitions must have been unworkable.

Related

Magento Error (ReflectionException): Class Unirgy\DropshipMicrosite\Helper\ProtectedCode does not exist

When I run my Magento 2 store, I get a white page with a whole lot of text, and then at the bottom I have this error. The Unirgy modules have cause us a lot of headaches so far. Does anyone know what's going on here?
1 exception(s): Exception #0 (ReflectionException):
Class Unirgy\DropshipMicrosite\Helper\ProtectedCode
does not exist Exception #0 (ReflectionException):
Class Unirgy\DropshipMicrosite\Helper\ProtectedCode does not exist
#1 Magento\Framework\Code\Reader\ClassReader->getConstructor() called
at [vendor/magento/framework/ObjectManager/Definition/Runtime.php:54]
#2 Magento\Framework\ObjectManager\Definition
\Runtime->getParameters() called at [vendor/magento/framework
/ObjectManager/Factory/Dynamic/Developer.php:48]
#3 Magento\Framework\ObjectManager\Factory\Dynamic
\Developer->create() called at [vendor/magento/framework
/ObjectManager/ObjectManager.php:70]
#4 Magento\Framework\ObjectManager\ObjectManager->get() called at
[app/code/Unirgy/Dropship/Helper/Data.php:2590]
#5 Unirgy\Dropship\Helper\Data->getObj() called at [app/code/Unirgy
/DropshipMicrosite/Helper/Data.php:123]
#6 Unirgy\DropshipMicrosite\Helper\Data->_msHlpPr() called at
[app/code/Unirgy/DropshipMicrosite/Helper/Data.php:155]
#7 Unirgy\DropshipMicrosite\Helper\Data->getCurrentVendor() called at
[app/code/Unirgy/DropshipMicrosite/Plugin/AppHttp.php:23]
#8 Unirgy\DropshipMicrosite\Plugin\AppHttp->beforeLaunch() called at
[vendor/magento/framework/Interception/Interceptor.php:121]
#9 Magento\Framework\App\Http\Interceptor->Magento\Framework
\Interception\{closure}() called at [vendor/magento/framework
/Interception/Interceptor.php:153]
#10 Magento\Framework\App\Http\Interceptor->___callPlugins() called
at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#11 Magento\Framework\App\Http\Interceptor->launch() called at
[vendor/magento/framework/App/Bootstrap.php:263]
#12 Magento\Framework\App\Bootstrap->run() called at
[pub/index.php:40]
Please check is this file available in you module
Class Unirgy\DropshipMicrosite\Helper\ProtectedCode
or Is there any grammatical error in file name

Is there a way to limit stack trace information in Flutter

I'm trying to find a way to make the Flutter unit test failures messages more useful to me.
Right now on a simple test that doesn't do anything it useful will produce a stack trace of 50+ lines of things that are all useless to me. I don't care what the Flutter framework is doing to get my test to run, I care about what I can control, in this example the top 2 lines.
Currently it does something like this:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure object was thrown running a test:
Expected: <true>
Actual: <false>
When the exception was thrown, this was the stack:
#4 main.<anonymous closure> (file:///D:/disclaimer_screen_test.dart:57:5)
<asynchronous suspension>
#5 main.<anonymous closure> (file:///D:/disclaimer_screen_test.dart)
#6 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart:146:29)
<asynchronous suspension>
#7 testWidgets.<anonymous closure>.<anonymous closure> (package:flutter_test/src/widget_tester.dart)
#8 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:784:19)
<asynchronous suspension>
#11 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:764:14)
#12 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1173:24)
#13 FakeAsync.run.<anonymous closure>.<anonymous closure> (package:fake_async/fake_async.dart:178:54)
#18 withClock (package:clock/src/default.dart:48:10)
#19 FakeAsync.run.<anonymous closure> (package:fake_async/fake_async.dart:178:22)
#24 FakeAsync.run (package:fake_async/fake_async.dart:178:7)
#25 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1170:15)
#26 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:138:24)
#27 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:175:19)
<asynchronous suspension>
#28 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart)
#33 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:173:13)
#34 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:231:15)
#39 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:228:5)
#40 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:383:17)
<asynchronous suspension>
#41 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart)
#46 Invoker._onRun.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:370:9)
#47 Invoker._guardIfGuarded (package:test_api/src/backend/invoker.dart:415:15)
#48 Invoker._onRun.<anonymous closure> (package:test_api/src/backend/invoker.dart:369:7)
#55 Invoker._onRun (package:test_api/src/backend/invoker.dart:368:11)
#56 LiveTestController.run (package:test_api/src/backend/live_test_controller.dart:153:11)
#57 RemoteListener._runLiveTest.<anonymous closure> (package:test_api/src/remote_listener.dart:256:16)
#62 RemoteListener._runLiveTest (package:test_api/src/remote_listener.dart:255:5)
#63 RemoteListener._serializeTest.<anonymous closure> (package:test_api/src/remote_listener.dart:208:7)
#81 _GuaranteeSink.add (package:stream_channel/src/guarantee_channel.dart:125:12)
#82 new _MultiChannel.<anonymous closure> (package:stream_channel/src/multi_channel.dart:159:31)
#86 CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11)
#120 new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1145:21)
#128 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:338:23)
#129 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:232:46)
#139 _Socket._onData (dart:io-patch/socket_patch.dart:2044:41)
#148 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1580:33)
#149 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1076:14)
(elided 111 frames from dart:async and package:stack_trace)
This was caught by the test expectation on the following line:
file:///D:/disclaimer_screen_test.dart line 57
The test description was:
someScreen Widget Test
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: someScreen Widget Test
✖ someScreen Widget Test
Exited (1)
Ideally I would like to limit or remove the stack trace altogether so that it looks something like this:
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure object was thrown running a test:
Expected: <true>
Actual: <false>
This was caught by the test expectation on the following line:
file:///D:/disclaimer_screen_test.dart line 57
The test description was:
someScreen Widget Test
════════════════════════════════════════════════════════════════════════════════════════════════════
Test failed. See exception logs above.
The test description was: someScreen Widget Test
✖ someScreen Widget Test
Exited (1)
This way I get all the relevant information to me without all the noise of things I cannot control and quite honestly are not broken. I trust that the Framework and 3rd party packages are working as expected, if they aren't I'm doing a different investigation.
I found the defaultStackFilter method but that appears to be an internal Flutter method rather than something I can control, perhaps I just don't understand it.
Is there a way to change the stack output as a whole or perhaps a way to disable it in the unit testing environment?
Thank you in advance!
To elaborate on Randal Schwartz's answer, here is the full code I used:
import 'package:stack_trace/stack_trace.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (FlutterErrorDetails details) {
print("Error : ${details.exception}");
print(Trace.from(details.stack!).terse);
};
Chain.capture(() async {
runApp(MyApp()); // starting point of app
}, onError: (error, stackTrace) {
print("Async Error : $error");
print(stackTrace.terse);
});
}
This incorporates another answer here which explains how to intercept both sync and async errors that occur within the Flutter context.
This gives us full control of how errors are displayed. I appreciate this particularly for the async case, where previously the stack traces did not contain any code which was written by me. Now it properly points to the originating network call that I made.
This approach seems like it should be standard practice, as it drastically reduces the amount of time and energy searching for the cause of errors.
Yes... the stack_trace package in the pub has this:
You can further clean up the stack trace using Trace.terse. This folds together multiple stack frames from the Dart core libraries, so that only the core library method that was directly called from user code is visible.
Very handy.

ComponentType Error When Clicking Edit Product in Magento 2.3.4

When clicking the edit product component type error showing magento 2.3.4
1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): The "componentType" configuration parameter is required for the "price_per_unit" component.
Exception #0 (Magento\Framework\Exception\LocalizedException): The "componentType" configuration parameter is required for the "price_per_unit" component.
#1 Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:414]
#2 Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:321]
#3 Magento\Framework\View\Element\UiComponentFactory->mergeMetadata() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:218]
#4 Magento\Framework\View\Element\UiComponentFactory->create() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:140]
#5 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:103]
#6 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:81]
#7 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:350]
#8 Magento\Framework\View\Layout->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#9 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:55]
#10 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#11 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:257]
#12 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:882]
#13 Magento\Framework\View\Layout->getBlock() called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#14 Magento\Backend\Model\View\Result\Page->setActiveMenu() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Edit.php:82]
#15 Magento\Catalog\Controller\Adminhtml\Product\Edit->execute() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:24]
#16 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:108]
#17 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:231]
#18 Magento\Backend\App\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#19 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#20 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]
#21 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#22 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->___callPlugins() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:39]
#24 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:159]
#25 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:99]
#26 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#27 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#28 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#29 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]
#30 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#31 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]
#32 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:40]
Though this is long overdue, we deeply apologies for that and hurry to provide you with a solution.
Based on the error provided, the "price_per_unit" attribute is missing in some of your attribute sets. There is a chance that you created/migrated your attribute sets after extension installation.
To solve this problem, please complete the following steps:
Open your attribute sets for editing
Make sure it contains the following group and the attribute - https://prnt.sc/17n8d4y
group: mageworx-dynamic-options
attribute: price_per_unit
If no, you need to create this group manually and drag and drop the attribute to this group from the Unassigned Attributes column.
Should you have any further questions or difficulties, we are always happy to assist.
Feel free to contact our Support Team at support#mageworx.com with inquiries.
Kindly,
The Mageworx Team
MageWorx Advanced Product Options - You'd need to speak to MageWorx

Zend_Exception with message 'Registry is already initialized'

Using Zend, Extjs, and socialengine4. I am adding users to the user table and they are successfully put into the database with the 'enabled' and 'verified' set at 1. I can add the new users to the table and set those values perfectly fine and when i go to the next page i can click on a link to the user's profile page that i have just created and the information that i have input for their profile is displayed. If i try to click on the link again i get the following error.
exception 'Zend_Exception' with message 'Registry is already initialized' in /var/www/web15/web/application/libraries/Zend/Registry.php:71
Stack trace:
#0 /var/www/web15/web/application/libraries/Engine/Registry.php(87): Zend_Registry::setInstance(Object(Engine_Registry))
#1 /var/www/web15/web/application/libraries/Engine/Registry.php(104): Engine_Registry::setInstance(Object(Engine_Registry))
#2 /var/www/web15/web/application/libraries/Engine/Registry.php(66): Engine_Registry::init()
#3 /var/www/web15/web/application/libraries/Engine/Registry.php(176): Engine_Registry::getInstance()
#4 /var/www/web15/web/application/modules/User/Model/User.php(231): Engine_Registry::get('database-defaul...')
#5 /var/www/web15/web/application/modules/User/controllers/ProfileController.php(63): User_Model_User->isAdmin()
#6 /var/www/web15/web/application/libraries/Zend/Controller/Action.php(513): User_ProfileController->indexAction()
#7 /var/www/web15/web/application/libraries/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('indexAction')
#8 /var/www/web15/web/application/libraries/Zend/Controller/Front.php(946): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 /var/www/web15/web/application/modules/Core/Bootstrap.php(75): Zend_Controller_Front->dispatch()
#10 /var/www/web15/web/application/libraries/Engine/Application.php(160): Core_Bootstrap->run()
#11 /var/www/web15/web/application/index.php(194): Engine_Application->run()
#12 /var/www/web15/web/index.php(24): include('/var/www/web15/...')
#13 {main}
Once this error is thrown it will reset my table values of 'enabled' and 'verified' to 0. The user will no longer show up on the page or when i click to browse members but its db entry is still there with its changed values.

Zend_Auth and Zend_Namespace Session Error

I'm developing an application, everything works fine but sometimes i get the following error:
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /usr/share/php/libzend-framework-php/Zend/Session.php:462 Stack trace: #0 /usr/share/php/libzend-framework-php/Zend/Session/Namespace.php(143): Zend_Session::start(true) #1 /var/vhosts/rmanager.vsnetwork.net/application/views/helpers/GetProjetoNome.php(7): Zend_Session_Namespace->__construct('rmanager') #2 [internal function]: Zend_View_Helper_GetProjetoNome->GetProjetoNome() #3 /usr/share/php/libzend-framework-php/Zend/View/Abstract.php(342): call_user_func_array(Array, Array) #4 /var/vhosts/rmanager.vsnetwork.net/application/layouts/scripts/layout.phtml(73): Zend_View_Abstract->__call('GetProjetoNome', Array) #5 /var/vhosts/rmanager.vsnetwork.net/application/layouts/scripts/layout.phtml(73): Zend_View->GetProjetoNome() #6 /usr/share/php/libzend-framework-php/Zend/View.php(108): include('/var/vhosts/rma...') #7 /usr/share/php/libzend-framework-php/Zend/View/Abstract.php(880) in /usr/share/php/libzend-framework-php/Zend/Session.php on line 462
If i refresh the page, it works.
Sometimes it returns me the error while i send post to the same page
I'm using Zend_Auth and Zend_Acl inside a plugin and Zend_Namespace in various places of my application.
Does anyone has idea why it is happing?
Thanks
It's kinda hard to help you with so little information, but as far as i read ealier this week when i play with session_namespace, you have to be very careful with it.
This paragraph has been very helpful for me
Don't ever start the session explicitly. Just use it automatically. I also use Zend_Auth and Zend_Sesison_Namespace many times but that error never comes.