All of a sudden I'm having problems with executing a view via Propel.
[wrapped: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'view_total_count_for_collection.ID' in 'field list']
Well, DUH. That's because there is no actual ID column in the view! So why have you built a model around a non-existant column?
Here's the relevant section of my schema.yml, generated by propel:build-schema
view_total_count_for_collection:
_attributes: { phpName: ViewTotalCountForCollection }
collection_id: { phpName: CollectionId, type: INTEGER, size: '11', required: true }
asset_count: { phpName: AssetCount, type: BIGINT, size: '21', required: true, defaultValue: '0' }
pallet_received: { phpName: PalletReceived, type: INTEGER, size: '11', required: false }
case_received: { phpName: CaseReceived, type: INTEGER, size: '11', required: false }
unit_received: { phpName: UnitReceived, type: INTEGER, size: '11', required: false }
total_pallets_for_asset: { phpName: TotalPalletsForAsset, type: DECIMAL, size: '32', scale: '0', required: false }
total_cases_for_asset: { phpName: TotalCasesForAsset, type: DECIMAL, size: '41', scale: '0', required: false }
total_units_for_asset: { phpName: TotalUnitsForAsset, type: DECIMAL, size: '41', scale: '0', required: false }
This is all fine, as far as I'm concerned. Other views seem to have a magical Id field declared, and have been working fine, and further research tells me that this is just what Propel does. It hasn't been a problem before.
However, now all of a sudden it's causing a problem. And I don't understand why. Can anyone help me to resolve this? So why does THIS particular definition in schema.yml NOT have an ID? And why would I need to suddenly have one anyway?
set primary key
not setting primary key default column is "id"
Related
My date field in Netlify is showing 08/19/2022 fam8/19/202205. How do I fix that?
My config.yml contains:
- {
label: 'Date',
name: 'date',
widget: 'datetime',
time_format: 'false',
format: 'MM-DD-YYYY',
picker_utc: true,
}
image of the error
The time_format option accepts either a boolean or Moment.js tokens (cf documentation).
In your case, you are giving it a string, which it is trying to interpret as the latter (hence the weird output).
Change it to a boolean (ie: no quotes) and it should work:
- label: 'Date'
name: 'date_test'
widget: 'datetime'
time_format: false
format: 'MM-DD-YYYY'
picker_utc: true
I've been looking for a way to override the default sorting of data which is based on primary key.
I found some configuration examples for sorting data from the documentation but it doesn't work.
It says
Unrecognized option "sort" under "easy_admin.list"
easy_admin:
entities:
Customer:
class: AppBundle\Entity\Customer
list:
sort: 'name'
form:
title: 'Add Customer'
form_options: {validation_groups:['Default']}
fields:
- name
- {property: 'gender', type: 'choice', type_options:
{
placeholder: 'Select your gender',
choices: {
Female: 'female',
Male: 'male'
}
} }
- {property: 'birthdate', type: 'date', type_options: {widget: 'single_text'}}
- isActive
new:
form_options: {validation_groups: ['Default','Customer']}
edit:
title: 'Edit Customer'
site_name: 'Premiere Sales'
You use sort option in the wrong place. You should set sort option under your entity scope of configuration:
easy_admin:
entities:
User:
# ...
list:
# if the sort order is not specified, 'DESC' is used
sort: 'createdAt'
It seems that the configuration I posted above is correct and I just restarted the server and the browser and it works fine
I use autoforms for my forms. Now I have a special problem and I am asking myself if its possible to solve this easy with autoforms.
With my autoforms I want to build a easy Category-Tree in my MongoDB. Just with a name and a parent (select).
This looks like this:
Categories.attachSchema(new SimpleSchema({
name : {
type: String,
label: "Name",
max: 200
},
parent : {
type : String,
allowedValues: [false, 'id_of_cat_1', 'id_of_cat_2', 'id_of_cat_3'],
optional : true,
autoform: {
options: [
{label: '- none -', value: false},
{label: 'cat 1', value: 'id_of_cat_1'},
{label: 'cat 2', value: 'id_of_cat_2'},
{label: 'cat 3', value: 'id_of_cat_3'}
]
}
}
}));
Very short and very simple. The autoforms now creates me the form and I am able to do stuff with it.
But whats the problem here ? The problem is the parent-value. Its type is String and because of this selecting "- none -" is not possible. But I want that the field parent in the database has a boolean value (false) when no parent is given.
The question is now how to solve this.
Is it better - and possible - to give a value 2 or more types ? If not it must be necessery to overwrite the value after or before isnerting to the collection - but this also does not work because the simpleSchema do deny this process. FOr overwriting I use matb33:collection-hooks.
You can use empty string instead:
parent : {
type : String,
allowedValues: ['', 'id_of_cat_1', 'id_of_cat_2', 'id_of_cat_3'],
optional : true,
autoform: {
options: [
{label: '- none -', value: ''},
{label: 'cat 1', value: 'id_of_cat_1'},
{label: 'cat 2', value: 'id_of_cat_2'},
{label: 'cat 3', value: 'id_of_cat_3'}
]
}
}
It makes sense since the empty string works as false in the if statement
I'm having the next problem, I have a grid with paging that is loaded via Ajax,
My problem is that i recieve about 8 millions of records,
When I use paging I get from 1 to 25...etc
but when i load the pagingbar store it only gives me that i have only 25 records because my ajax only calls from 1 to 25... why is this? any ideas?
Regards
My code:
Store
Ext.define('IE.store.reenvios.Reenvio', {
extend: 'Ext.data.Store',
alias: 'store.Reenvios',
storeId: 'ReenviosStore',
model: 'IE.model.reenvios.Reenvio',
proxy: {
type: 'ajax',
api: {
//
read: 'resendTransaction/fetchResend'
},
reader: {
type: 'json',
root: '',
totalProperty: 'rowCount'
}
},
autoLoad: false,
autoSync: false
});
Controller
store.getProxy().extraParams = {
'folioType':folioT.value,
'folio':folioN.value,
'status':estatus.value,
'date':date.value,
'start':0,
'limit':26,
'pageSize':25,
'tamanoPagina':''};
store.load({...
Seeing the JSON response would be helpful, so I could see the name of the property that contains the total number of records.
I have a feeling the issue is because you set totalProperty: 'rowCount'. The property rowCount is likely the number of rows returned (ie, 25 or less), but you want the totalProperty set to the property that contains the total number of records. See the docs for more info. http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.reader.Reader-cfg-totalProperty
This just doesn't make sense. I can't seem to get a simple Symfony2 validation working.
$insert = new MyEntity();
$insert->setTest1( 'test' );
$validator = $this->get('validator');
$errors = $validator->validate($insert);
...but $errors is always an object with an empty constraints array. It never fails the validation.
My configuration (Yaml):
MyBundle\Entity\MyEntity:
properties:
test1:
- MinLength: 10
- Email
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
test1:
type: string
length: 255
column: test_1
test2:
type: integer
column: test_2
lifecycleCallbacks: { }
You're mixing doctrine's mapping and symfony's validation in a single yml file.
The validation configuration in yml is loaded from the files:
Acme/YourBundle/Resources/config/validation.yml // YAML
Acme/YourBundle/Resources/config/validation.xml // XML
And the mapping information should be placed in one of:
Acme/YourBundle/Resources/config/doctrine/MyEntity.orm.yml // YAML
Acme/YourBundle/Resources/config/doctrine/MyEntity.orm.xml // XML
Acme/YourBundle/Resources/config/doctrine/orm/MyEntity.orm.yml // YAML
Acme/YourBundle/Resources/config/doctrine/orm/MyEntity.orm.xml // XML