yii-extensions

model->attributes in Yii2 always has NULL value

别说谁变了你拦得住时间么 提交于 2019-12-04 01:56:47
I have one temporary model as viewModel. In my CRUD actions (for example actionCreate) I want to get this viewModel data and assign that to a ActiveRecord model. I used below code but my model object atrribute always show NULL value for attributes: $model = new _Users(); if ($model->load(Yii::$app->request->post())) { Yii::info($model->attributes,'test'); // NULL $attributesValue =[ 'title' => $_POST['_Users']['title'], 'type' => $_POST['_Users']['type'], ]; $model->attributes = $attributesValue; Yii::info($model->attributes,'test'); // NULL $dbModel = new Users(); $dbModel->title = $model-

When to use components and when to use extensions in Yii?

十年热恋 提交于 2019-12-03 10:55:07
问题 I'm a little bit confused about the purpose of components and extensions folders in protected/ Please clarify. 回答1: According to my little experience on Yii: Components are the classes which can help you write the business logic on the basis of your models. You definitely don't want to code all of your work in controllers, then you need the component to distribute your code and call it in controller. Extensions are like the libraries, which basically are not dependent on your models, and

When to use components and when to use extensions in Yii?

微笑、不失礼 提交于 2019-12-03 01:22:01
I'm a little bit confused about the purpose of components and extensions folders in protected/ Please clarify. According to my little experience on Yii: Components are the classes which can help you write the business logic on the basis of your models. You definitely don't want to code all of your work in controllers, then you need the component to distribute your code and call it in controller. Extensions are like the libraries, which basically are not dependent on your models, and hence can be reused anywhere in current or later projects. For example: an email extension, or a class that send

How can I disable yii-debug-toolbar on a specific view?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 22:51:07
How can I disable yii-debug-toolbar on a specific view especially on partial rendered views? Is this possible? p.s. Yii-debug-toolbar does unfortunately not exist as a tag below. Put this in your layout or view file: if (class_exists('yii\debug\Module')) { $this->off(\yii\web\View::EVENT_END_BODY, [\yii\debug\Module::getInstance(), 'renderToolbar']); } This removes the callback that renders the toolbar from the event that runs at the end of the layout, where you have $this->endBody() . Tanvir Rahman Just Remove or comments out the those two lines from /config/web.php $config['bootstrap'][] =

Yii: Any extension to implement embedded google map

不想你离开。 提交于 2019-12-02 13:19:27
im a yiibie, and i want to use google maps in my project just like embedded google maps. For example i want that when an ngo(in my case) is registering there ngo they could give there address, type of map etc (just like in embedded google map) on the map so that people visiting that ngo page could easily locate that ngo and can get a route to that ngo, i have no idea of how and where using these google maps, please help me, thank you. I don't know extension but you can easly create you map this way (in this sample there isn't the google maps key but if your app usage require this you should

Using box/spout 3rd party library in Yii application command

╄→гoц情女王★ 提交于 2019-12-02 08:54:17
I want to use https://github.com/box/spout library in my Yii project (in one of commands). I'm not using Composer, so I simple downloaded the extension and put in extensions/spout/Box/ . In my config/main.php I've added line 'import' => array( ... 'application.extensions.spout.*' ), And in my command I've added following lines: require_once Yii::app()->basePath . '/extensions/spout/Box/Spout/Reader/ReaderFactory.php'; require_once Yii::app()->basePath . '/extensions/spout/Box/Spout/Common/Type.php'; When I'm calling $reader = ReaderFactory::create(Type::CSV); I'm getting following error: PHP

Yii: Video upload gets failed upon uploading

纵饮孤独 提交于 2019-12-02 07:45:23
问题 I am yiibie. What i am tying to do to upload videos, for that i am using Uploadmiltifiles extension and following this link http://www.yiiframework.com/extension/uploadmultifiles . I have followed every thing but when i upload a video file(.3gp file) i says "testingvideo.3gp" failed and upon submit it says "Video file cannot be blank" This is the code of my videoController which has the actionupload() function . <?php class VideoController extends RController { /** * @var string the default

Yii Index View Data Rendering With Condition

蹲街弑〆低调 提交于 2019-12-02 07:40:31
I am new to yii framework i have created an yii web application with one module . Now my question is i have added an sample data into my module in my module i have an columns name,dept and and active ,i want to render the data in the grid view only the data where active=0 , Can anyone help me how to change the data rendering query and how to add the condition <div class="block"> <div class="content"> <h2 class="title">Users's details</h2> <div class="inner"> <?php $this->widget('zii.widgets.CDetailView', array( 'data' => $model, 'attributes' => array( 'user_id', 'user_name', 'userpass',

Yii: Video upload gets failed upon uploading

别等时光非礼了梦想. 提交于 2019-12-02 06:57:28
I am yiibie. What i am tying to do to upload videos, for that i am using Uploadmiltifiles extension and following this link http://www.yiiframework.com/extension/uploadmultifiles . I have followed every thing but when i upload a video file(.3gp file) i says "testingvideo.3gp" failed and upon submit it says "Video file cannot be blank" This is the code of my videoController which has the actionupload() function . <?php class VideoController extends RController { /** * @var string the default layout for the views. Defaults to '//layouts/column2', meaning * using two-column layout. See 'protected

Credit card transactions in Yii [closed]

泄露秘密 提交于 2019-12-02 06:23:11
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . How can we implement credit card transactions in Yii? 回答1: Your question is not that detailed of what you have tried or you are asking about API or something. What i can say is Stripe has a PHP library to accept