I am working with zend framework and I want to know how to pass array params to zend url. I mean:
lala.com?foo=123 => lala.com/foo/123/
What about
lala.com?foo[]=123&foo[]=456 => ???
Thanks in advance
I don't think it is possible at all. See http://framework.zend.com/issues/browse/ZF-2986
Related
I want to convert all URLs to lowercase.
For example:
https://ABC123.com/ -> https://abc123.com/
https://StackoverFlow.com/ -> https://stackoverflow.com/
Thanks in advance
Do you want to force all URL to lowercase in browser? If it is, You can add
services.AddRouting(options => options.LowercaseUrls = true);
in your startup.cs class.
The original code is:
modelBuilder.Entity<OriginalClass>().Map<OtherClass>(x => x.Requires("Field1").HasValue("Value1"));
It doesn't compile and I can't seem to find the equivalent code.
I have found the answer here
https://learn.microsoft.com/en-us/ef/core/modeling/relational/inheritance
My code for core will be something like this
modelBuilder.Entity<OriginalClass>().HasDiscriminator<string>("Field1").HasValue<OtherClass>("Value1").HasValue<OtherClass2>("Value2");
Here is how you could translate it to entityworker
modelBuilder.Entity<OtherClass>().
HasNotNullable(x => x.Field1).
HasDefaultOnEmpty(x=> x.Field1, "the field is empty"));
read Attribute section
https://github.com/AlenToma/EntityWorker.Core/blob/master/Documentation/Attributes.md
I use Zend_Form_Element_Note in Zend Framework 1.12, but this method doesn't exist in Zend Framework 1.11.7,which similar methods can I use ?.
For resolved this problem I used.
$element = new Zend_Form_Element_Hidden('name');
$element->setLabel('somelabel');
This will show just label and remove name and value propertie by javascript
$("input[type=hidden]").remove();
I am trying to have a REST design, but I am running in a bit of a problem. I have a resource schedule. Therefore, the normal notation of /schedules/{id} is not very applicable since I would like to have /schedules/{day}/{month}/{year} and then apply REST, and have /edit and such.
Is there a way to do this with Route::resource() ? or do I need to do them through Route::get() ?
As far as I know route::resource only gives you the routes that are detailed in the documentation so for what you want you would need to declare your own route. It is still restful and if it is only one of the resourceful routes you want to change you should still be able to do the following because the routes are prioritized in the order they are declared.
Route::get('schedule/{day}/{month}/{year}/edit', array('as' => 'editSchedule', 'uses' => 'ScheduleController#edit'));
Route::resource('schedule', 'ScheduleController');
Yes, there is a very simple way. Here is an example:
Specify your route like this:
Route::resource("schedules/day.month.year", "ScheduleController");
The request will be like this:
/schedules/day/1/month/12/year/2014
And now you can get all three parameters in show method of your
contoller:
public function show($day, $month, $year)
Hi there this might be handy if you want to call your route by name. Also you can use one or multiple parameters. It works with me on laravel 5.1
According to the laravel docs:
http://laravel.com/docs/5.1/routing#named-routes
Route::get('user/{id}/profile', ['as' => 'profile', function ($id) {
//
}]);
$url = route('profile', ['id' => 1]);
This works with Route:resource aswell.
for example:
Route::resource('{foo}/{bar}/dashboard', 'YourController');
Will create named routes like: {foo}.{bar}.dashboard.show
To call this with the route method, you set it up as followed.
route('{foo}.{bar}.dashboard.show', ['foo' => 1, 'bar'=> 2])
Which will create the url yourdomain.com/1/2/dashboard
Ill hope this is usefull.
Pascal
I'm having problem with custom builded validator that does not returns any error. I copied a file NotEmpty.php form folder library/Zend/Validate, rename class Zend_Validate_NotEmpty to My_Validate_EmailConfirmation and put it into folder My/Validate.
If I call this class like
->setRequired(true)->addValidator('NotEmpty',true,array('messages' => array('isEmpty' => "bla")));
I get the correct error, but if i call it like
->setRequired(true)->addValidator('EmailConfirmation',true,array('mess ages' => array('isEmpty' => "bla")))->addPrefixPath('My_Validate','My/Validate/','validate');
i get nothing...
What am i doing wrong?
Thanks is advanced for your answers...
Have you tried to set in your bootstrap file your new namespace?
Zend_Loader_Autoloader::getInstance()->registerNamespace('My');
Also, why not you just extends the NotEmpty validator instead of duplicate the class?